changed messages to be json and inherit from message class
This commit is contained in:
parent
a85cf6a49c
commit
2cddc88b24
|
@ -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"),
|
||||||
|
})
|
||||||
|
|
||||||
# })
|
class Recieved( Message ):
|
||||||
|
def __init__( self, query ):
|
||||||
# def sent( sefl, query ):
|
super( Recieved, self ).__init__(query)
|
||||||
# lastactiontime, status, ackdata = row[6:8]
|
for entry in query:
|
||||||
# 'lastactiontime':lastactiontime,
|
self.data.append({
|
||||||
# 'status':status,
|
'msgid':entry[0].encode(),
|
||||||
# 'ackdata': ackdata
|
'toAddress':entry[1],
|
||||||
|
'fromAddress':entry[2],
|
||||||
# def ( self, query ):
|
'subject':entry[3].encode(),
|
||||||
# received, read = row[6:7]
|
'message':entry[4].encode(),
|
||||||
# 'receivedTime':received
|
'encodingType':entry[5],
|
||||||
# 'read': read
|
'receivedTime':entry[6],
|
||||||
|
'read': entry[7],
|
||||||
|
})
|
||||||
|
|
||||||
class _handle_request( object ):
|
class _handle_request( object ):
|
||||||
def ping( self, *args ):
|
def ping( self, *args ):
|
||||||
|
|
Reference in New Issue
Block a user