Add getInboxMessagesByAddress API command
This commit is contained in:
parent
a8693156b0
commit
c655b9a506
|
@ -3712,6 +3712,24 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':2,'receivedTime':received},indent=4, separators=(',', ': '))
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':2,'receivedTime':received},indent=4, separators=(',', ': '))
|
||||||
data += ']}'
|
data += ']}'
|
||||||
return data
|
return data
|
||||||
|
elif method == 'getInboxMessagesByAddress':
|
||||||
|
toAddress = params[0]
|
||||||
|
v = (toAddress,)
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
shared.sqlSubmitQueue.put('''SELECT msgid, fromaddress, subject, received, message FROM inbox WHERE toAddress=?''')
|
||||||
|
shared.sqlSubmitQueue.put(v)
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlLock.release()
|
||||||
|
data = '{"inboxMessages":['
|
||||||
|
for row in queryreturn:
|
||||||
|
msgid, fromAddress, subject, received, message, = row
|
||||||
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
|
if len(data) > 25:
|
||||||
|
data += ','
|
||||||
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':2,'receivedTime':received},indent=4, separators=(',', ': '))
|
||||||
|
data += ']}'
|
||||||
|
return data
|
||||||
elif method == 'trashMessage':
|
elif method == 'trashMessage':
|
||||||
if len(params) == 0:
|
if len(params) == 0:
|
||||||
return 'API Error 0000: I need parameters!'
|
return 'API Error 0000: I need parameters!'
|
||||||
|
|
Reference in New Issue
Block a user