changed messages to be json and inherit from message class

This commit is contained in:
jackson- 2015-01-30 14:09:37 -05:00
parent a85cf6a49c
commit 2cddc88b24

View File

@ -16,32 +16,41 @@ from pyelliptic.openssl import OpenSSL
str_chan = '[chan]' str_chan = '[chan]'
# class messages( array ): class Message:
def __init__(self, query):
self.data = []
# def base( self ): class Sent( Message ):
# msgid, toAddress, fromAddress, subject, message, encodingtype, received, read= query def __init__( self, query ):
# subject = shared.fixPotentiallyInvalidUTF8Data(subject) super( Sent, self).__init__()
# message = shared.fixPotentiallyInvalidUTF8Data(message) # lastactiontime, status, ackdata = query[6:8]
# data.append({ for entry in query:
# 'msgid':msgid.encode('hex'), self.data.append({
# 'toAddress':toAddress, 'msgid':entry[0].encode(),
# 'fromAddress':fromAddress, 'toAddress':entry[1],
# 'subject':subject.encode('base64'), 'fromAddress':entry[2],
# 'message':message.encode('base64'), 'subject':entry[3].encode(),
# 'encodingType':encodingtype, 'message':entry[4].encode(),
'encodingType':entry[5],
# }) 'lastactiontime':lastactiontime,
'status':status,
'ackdata': ackdata.endcode("hex"),
})
# def sent( sefl, query ): class Recieved( Message ):
# lastactiontime, status, ackdata = row[6:8] def __init__( self, query ):
# 'lastactiontime':lastactiontime, super( Recieved, self ).__init__(query)
# 'status':status, for entry in query:
# 'ackdata': ackdata self.data.append({
'msgid':entry[0].encode(),
# def ( self, query ): 'toAddress':entry[1],
# received, read = row[6:7] 'fromAddress':entry[2],
# 'receivedTime':received 'subject':entry[3].encode(),
# 'read': read 'message':entry[4].encode(),
'encodingType':entry[5],
'receivedTime':entry[6],
'read': entry[7],
})
class _handle_request( object ): class _handle_request( object ):
def ping( self, *args ): def ping( self, *args ):