@@ -54,12 +54,13 @@ def __init__(self, number, text, smsc=None):
5454class ReceivedSms (Sms ):
5555 """ An SMS message that has been received (MT) """
5656
57- def __init__ (self , gsmModem , status , number , time , text , smsc = None , udh = []):
57+ def __init__ (self , gsmModem , status , number , time , text , smsc = None , udh = [], index = None ):
5858 super (ReceivedSms , self ).__init__ (number , text , smsc )
5959 self ._gsmModem = weakref .proxy (gsmModem )
6060 self .status = status
6161 self .time = time
6262 self .udh = udh
63+ self .index = index
6364
6465 def reply (self , message ):
6566 """ Convenience method that sends a reply SMS to the sender of this message """
@@ -1114,7 +1115,7 @@ def listStoredSms(self, status=Sms.STATUS_ALL, memory=None, delete=False):
11141115 if msgIndex != None and len (msgLines ) > 0 :
11151116 msgText = '\n ' .join (msgLines )
11161117 msgLines = []
1117- messages .append (ReceivedSms (self , Sms .TEXT_MODE_STATUS_MAP [msgStatus ], number , parseTextModeTimeStr (msgTime ), msgText ))
1118+ messages .append (ReceivedSms (self , Sms .TEXT_MODE_STATUS_MAP [msgStatus ], number , parseTextModeTimeStr (msgTime ), msgText , None , [], msgIndex ))
11181119 delMessages .add (int (msgIndex ))
11191120 msgIndex , msgStatus , number , msgTime = cmglMatch .groups ()
11201121 msgLines = []
@@ -1124,7 +1125,7 @@ def listStoredSms(self, status=Sms.STATUS_ALL, memory=None, delete=False):
11241125 if msgIndex != None and len (msgLines ) > 0 :
11251126 msgText = '\n ' .join (msgLines )
11261127 msgLines = []
1127- messages .append (ReceivedSms (self , Sms .TEXT_MODE_STATUS_MAP [msgStatus ], number , parseTextModeTimeStr (msgTime ), msgText ))
1128+ messages .append (ReceivedSms (self , Sms .TEXT_MODE_STATUS_MAP [msgStatus ], number , parseTextModeTimeStr (msgTime ), msgText , None , [], msgIndex ))
11281129 delMessages .add (int (msgIndex ))
11291130 else :
11301131 cmglRegex = re .compile ('^\+CMGL:\s*(\d+),\s*(\d+),.*$' )
@@ -1148,7 +1149,7 @@ def listStoredSms(self, status=Sms.STATUS_ALL, memory=None, delete=False):
11481149 # todo: make better fix
11491150 else :
11501151 if smsDict ['type' ] == 'SMS-DELIVER' :
1151- sms = ReceivedSms (self , int (msgStat ), smsDict ['number' ], smsDict ['time' ], smsDict ['text' ], smsDict ['smsc' ], smsDict .get ('udh' , []))
1152+ sms = ReceivedSms (self , int (msgStat ), smsDict ['number' ], smsDict ['time' ], smsDict ['text' ], smsDict ['smsc' ], smsDict .get ('udh' , []), msgIndex )
11521153 elif smsDict ['type' ] == 'SMS-STATUS-REPORT' :
11531154 sms = StatusReport (self , int (msgStat ), smsDict ['reference' ], smsDict ['number' ], smsDict ['time' ], smsDict ['discharge' ], smsDict ['status' ])
11541155 else :
0 commit comments