Merge branch 'master' of git://github.com/Eylrid/PyBitmessage into Eylrid-master

This commit is contained in:
Jonathan Warren 2013-09-03 00:26:43 -04:00
commit cf52d93a67

View File

@ -171,6 +171,21 @@ 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()
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 += ']}'
return data
elif method == 'createRandomAddress':
if len(params) == 0:
raise APIError(0, 'I need parameters!')