コード例 #1
0
ファイル: middleware.py プロジェクト: achiang/wader
        def get_sms_cb(rawsms):
            try:
                sms = Message.from_pdu(rawsms[0].group('pdu'))
                sms.where = int(rawsms[0].group('where'))
                sms.index = index
            except IndexError:
                # handle bogus CMTI notifications, see #180
                return None

            return sms
コード例 #2
0
ファイル: middleware.py プロジェクト: achiang/wader
 def get_all_sms_cb(messages):
     sms_list = []
     for rawsms in messages:
         try:
             sms = Message.from_pdu(rawsms.group('pdu'))
             sms.index = int(rawsms.group('id'))
             sms.where = int(rawsms.group('where'))
             sms_list.append(sms)
         except ValueError:
             log.err(ex.MalformedSMSError,
                     "Malformed PDU: %s" % rawsms.group('pdu'))
     return sms_list