Module sms
[hide private]
[frames] | no frames]

Module sms

source code


Code to handle SMS items.

The format for the SMS item is standardized.  It is an object with the following
attributes:

_from: string (email addr or phone #)
_to: string (email addr or phone #) Deprecated, should use add_recipient()
subject: string
text: string
datetime: string "YYYYMMDDThhmmss" or (y,m,d,h,m)
callback: string (optional callback phone #)
folder: string (where this item belongs: 'Inbox', 'Sent', 'Saved')
locked: True/False
msg_id: unique message id (hexstring sha encoded (datetime+text))
priority: (normal/high)
read: (T/F)

available methods:

add_recipient(name, confirmed=None, confirmed_datetime=None)
  - name: email addr or phone # of the recipient
  - confirmed: True/False/None
  - confirmed_datetime: "YYYYMMDDThhmmss" or (y,m,d,h,m)

confirm_recipient(name, confirmed_datetime)
  - name: email addr or phone # of the recipient
  - confirmed_datetime: "YYYYMMDDThhmmss" or (y,m,d,h,m)


The format for the Canned SMS Message item is standard.  It is an object with
the following attributes:

user_list: ['msg1', 'msg2', ...] list of user canned messages.
builtin_list: ['msg1', 'msg2', ...] list of built-in canned messages.
           This attribute is Read-Only.


To implement SMS read for a phone module:
 Add an entry into Profile._supportedsyncs:
        ...
        ('sms', 'read', None),     # sms reading

 Implement the following method in your Phone class: 
    def getsms(self, result):
        ...
        return result

The result dict key for the SMS messages is 'sms', which is a dict of SMSEntry
objetcs.
The result dict key for the canned messages is 'canned_msg', which has the
following format:

result['canned_msg']=[{ 'text': 'Yes', 'type': 'builtin' },
                      { 'text': 'No', 'type': 'user' }, ... ]

Classes [hide private]
  SMSDataObject
  CannedMsgDataObject
  SMSEntry
  CannedMsgEntry
Variables [hide private]
  smsobjectfactory = database.dataobjectfactory(SMSDataObject)
  cannedmsgobjectfactory = database.dataobjectfactory(CannedMsgD...
Variables Details [hide private]

cannedmsgobjectfactory

Value:
database.dataobjectfactory(CannedMsgDataObject)