From 3ca4578f7ff576c7feb8678c416d58a217144164 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Tue, 3 Sep 2013 00:30:48 -0400 Subject: [PATCH] minor changes to previous commit- adding listAddressBook to API --- src/bitmessagemain.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 71ad201e..570d13c2 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -171,19 +171,15 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): streamNumber, 'enabled': shared.config.getboolean(addressInKeysFile, 'enabled')}, indent=4, separators=(',', ': ')) data += ']}' return data - elif method == 'listAddressbook': - shared.sqlLock.acquire() - shared.sqlSubmitQueue.put('''SELECT label, address from addressbook''') - shared.sqlSubmitQueue.put('') - queryreturn = shared.sqlReturnQueue.get() - shared.sqlLock.release() + elif method == 'listAddressBook' or method == 'listAddressbook': + queryreturn = sqlQuery('''SELECT label, address from addressbook''') data = '{"addresses":[' for row in queryreturn: label, address = row label = shared.fixPotentiallyInvalidUTF8Data(label) if len(data) > 20: data += ',' - data += json.dumps({'label':label.encode('base64'), 'address': address}) + data += json.dumps({'label':label.encode('base64'), 'address': address}, indent=4, separators=(',', ': ')) data += ']}' return data elif method == 'createRandomAddress':