new API command: listAddressBook #469

Merged
Atheros1 merged 3 commits from master into master 2013-09-03 06:32:22 +02:00
Showing only changes of commit 3ca4578f7f - Show all commits

View File

@ -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':