24 lines
776 B
Python
24 lines
776 B
Python
import abc
|
|
|
|
|
|
class Sms(object):
|
|
""" Abstract SMS message base class """
|
|
__metaclass__ = abc.ABCMeta
|
|
|
|
# Some constants to ease handling SMS statuses
|
|
STATUS_RECEIVED_UNREAD = 0
|
|
STATUS_RECEIVED_READ = 1
|
|
STATUS_STORED_UNSENT = 2
|
|
STATUS_STORED_SENT = 3
|
|
STATUS_ALL = 4
|
|
# ...and a handy converter for text mode statuses
|
|
TEXT_MODE_STATUS_MAP = {'REC UNREAD': STATUS_RECEIVED_UNREAD,
|
|
'REC READ': STATUS_RECEIVED_READ,
|
|
'STO UNSENT': STATUS_STORED_UNSENT,
|
|
'STO SENT': STATUS_STORED_SENT,
|
|
'ALL': STATUS_ALL}
|
|
|
|
def __init__(self, number, text, smsc=None):
|
|
self.number = number
|
|
self.text = text
|
|
self.smsc = smsc |