Merge branch 'master' of http://github.com/acejam/PyBitmessage into acejam-master

This commit is contained in:
Jonathan Warren 2013-06-18 13:12:49 -04:00
commit 461a49f99f

View File

@ -4381,6 +4381,22 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
'base64'), 'message': message.encode('base64'), 'encodingType': 2, 'receivedTime': received}, indent=4, separators=(',', ': ')) 'base64'), 'message': message.encode('base64'), 'encodingType': 2, 'receivedTime': received}, indent=4, separators=(',', ': '))
data += ']}' data += ']}'
return data return data
elif method == 'getInboxMessageById':
msgid = params[0].decode('hex')
v = (msgid,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT toaddress, fromaddress, subject, received, message FROM inbox WHERE msgid=?''')
shared.sqlSubmitQueue.put(v)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"inboxMessage":['
for row in queryreturn:
toAddress, fromAddress, subject, received, message, = 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':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!'