sms

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSMS        = errors.New("sms content invalid")  // error for invalid single SMSs line of GSM channel
	ErrInvalidBody       = errors.New("invalid http body")    // error if http body content not contains required strings
	ErrNoContent         = errors.New("no sms available")     // error for storage if no messages saved
	ErrTimeInvalid       = errors.New("time string invalid")  // error for parsing sms if time string not parsable
	ErrSMSSentInProgress = errors.New("send sms in progress") // error for waiting sms send state
	ErrSMSSentFailed     = errors.New("send sms failed")      // error if sms send failed
	ErrSMSSSentNotFound  = errors.New("sms key not found")    // error id unique sms key not found
)

Functions

This section is empty.

Types

type SMS

type SMS struct {
	Direction string    // messade direction. only in or out
	Date      time.Time // event time
	From      string    // sender id
	To        string    // receiver id
	Text      string    // sms content
	Read      bool      // sms was sent to user
	Sent      bool      // sms was sent to remote
	UID       string    // unique sms ID
}

SMS - universal for inbox or outbox struct of single SMS message

func NewSMS

func NewSMS(to, text string) SMS

NewSMS - create new SMS message. May used only with sending SMS

to - destination phone number
text - text of sms message

type SMSStore

type SMSStore struct {
	Store map[int][]SMS // sms inmemory storage
	// contains filtered or unexported fields
}

func NewStore

func NewStore(freeze, interval int) *SMSStore

NewStore - create new sms storage instance

func (*SMSStore) GetCurrentSMSFromStore

func (sms *SMSStore) GetCurrentSMSFromStore(ch int) ([]SMS, error)

GetCurrentSMSFromStore - get current inmemory stored sms messages of GSM channel

ch - channel number

func (*SMSStore) GetUnreadSMS

func (sms *SMSStore) GetUnreadSMS(ch int) ([]SMS, error)

GetUnreadSMS - get unread messages from SMSs storage of GSM channel

ch - channel number

func (*SMSStore) GetUnsentSMS

func (sms *SMSStore) GetUnsentSMS(ch int) ([]SMS, error)

GetUnsentSMS - get unsent messages from SMSs storage of GSM channel

ch - channel number

func (*SMSStore) ParseSMS

func (sms *SMSStore) ParseSMS(body string) error

ParseSMS - parse full html body from GoIP gateway

func (*SMSStore) SetRead added in v1.0.2

func (sms *SMSStore) SetRead(ch int, uid string) error

SetRead - set sms as read

func (*SMSStore) SetSent added in v1.0.2

func (sms *SMSStore) SetSent(ch int, uid string) error

SetSent - set sms as sent

func (*SMSStore) Stop

func (sms *SMSStore) Stop()

Stop - stops SMS processes such cleaner or getSMSfromline

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL