New API command getSentMessageByAckData and modified the getAllSentMessages and getSentMessageById commands to return ackData
This commit is contained in:
parent
b2f8a76b58
commit
e49e9a60b0
|
@ -4401,18 +4401,18 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
return data
|
return data
|
||||||
elif method == 'getAllSentMessages':
|
elif method == 'getAllSentMessages':
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status FROM sent where folder='sent' ORDER BY lastactiontime''')
|
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent where folder='sent' ORDER BY lastactiontime''')
|
||||||
shared.sqlSubmitQueue.put('')
|
shared.sqlSubmitQueue.put('')
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
data = '{"sentMessages":['
|
data = '{"sentMessages":['
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status = row
|
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
|
||||||
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
if len(data) > 25:
|
if len(data) > 25:
|
||||||
data += ','
|
data += ','
|
||||||
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status},indent=4, separators=(',', ': '))
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status,'ackData':ackdata.encode('hex')},indent=4, separators=(',', ': '))
|
||||||
data += ']}'
|
data += ']}'
|
||||||
return data
|
return data
|
||||||
elif method == 'getInboxMessagesByAddress':
|
elif method == 'getInboxMessagesByAddress':
|
||||||
|
@ -4439,16 +4439,34 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
msgid = params[0].decode('hex')
|
msgid = params[0].decode('hex')
|
||||||
v = (msgid,)
|
v = (msgid,)
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status FROM sent WHERE msgid=?''')
|
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE msgid=?''')
|
||||||
shared.sqlSubmitQueue.put(v)
|
shared.sqlSubmitQueue.put(v)
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
data = '{"sentMessage":['
|
data = '{"sentMessage":['
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status = row
|
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
|
||||||
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status},indent=4, separators=(',', ': '))
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status,'ackData':ackdata.encode('hex')},indent=4, separators=(',', ': '))
|
||||||
|
data += ']}'
|
||||||
|
return data
|
||||||
|
elif method == 'getSentMessageByAckData':
|
||||||
|
if len(params) == 0:
|
||||||
|
return 'API Error 0000: I need parameters!'
|
||||||
|
ackData = params[0].decode('hex')
|
||||||
|
v = (ackData,)
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE ackdata=?''')
|
||||||
|
shared.sqlSubmitQueue.put(v)
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlLock.release()
|
||||||
|
data = '{"sentMessage":['
|
||||||
|
for row in queryreturn:
|
||||||
|
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
|
||||||
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status,'ackData':ackdata.encode('hex')},indent=4, separators=(',', ': '))
|
||||||
data += ']}'
|
data += ']}'
|
||||||
return data
|
return data
|
||||||
elif (method == 'trashMessage') or (method == 'trashInboxMessage'):
|
elif (method == 'trashMessage') or (method == 'trashInboxMessage'):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user