Only return one item for certain API commands

This commit is contained in:
Jonathan Warren 2013-07-31 12:08:56 -04:00
parent ef7d602bb6
commit cddfe2c44f
2 changed files with 6 additions and 5 deletions

View File

@ -341,8 +341,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
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, 'receivedTime':received, 'read': read}, indent=4, separators=(',', ': '))
data += ']}'
return data
data += ']}'
return data
elif method == 'getAllSentMessages':
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent where folder='sent' ORDER BY lastactiontime''')
@ -395,8 +395,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
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 += ']}'
return data
data += ']}'
return data
elif method == 'getSentMessagesByAddress' or method == 'getSentMessagesBySender':
if len(params) == 0:
return 'API Error 0000: I need parameters!'

View File

@ -414,7 +414,8 @@ class singleWorker(threading.Thread):
objectType = 'broadcast'
shared.inventory[inventoryHash] = (
objectType, streamNumber, payload, int(time.time()))
print 'sending inv (within sendBroadcast function)'
with shared.printLock:
print 'sending inv (within sendBroadcast function) for object:', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash))