From a4b5ded803ca42ba88de9de52ed084852fc8f9dc Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sat, 2 Nov 2013 00:02:46 -0400 Subject: [PATCH] we no longer need to add chans to our address book --- src/bitmessagemain.py | 21 +-------------------- src/bitmessageqt/__init__.py | 5 ++--- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 3900b99d..c05b724f 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -415,14 +415,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): if len(queueReturn) == 0: raise APIError(24, 'Chan address is already present.') address = queueReturn[0] - - #add address to addressbook - queryreturn = sqlQuery("SELECT address FROM addressbook WHERE address=?", address) - if queryreturn == []: - sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address) - shared.UISignalQueue.put(('rerenderInboxFromLabels','')) - shared.UISignalQueue.put(('rerenderSentToLabels','')) - shared.UISignalQueue.put(('rerenderAddressBook','')) return address elif method == 'joinChan': if len(params) < 2: @@ -450,14 +442,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): raise APIError(18, 'Chan name does not match address.') if len(addressGeneratorReturnValue) == 0: raise APIError(24, 'Chan address is already present.') - createdAddress = addressGeneratorReturnValue[0] - #add address to addressbook - queryreturn = sqlQuery("SELECT address FROM addressbook WHERE address=?", createdAddress) - if queryreturn == []: - sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, createdAddress) - shared.UISignalQueue.put(('rerenderInboxFromLabels','')) - shared.UISignalQueue.put(('rerenderSentToLabels','')) - shared.UISignalQueue.put(('rerenderAddressBook','')) + createdAddress = addressGeneratorReturnValue[0] # in case we ever want it for anything. return "success" elif method == 'leaveChan': if len(params) == 0: @@ -473,10 +458,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): shared.config.remove_section(address) with open(shared.appdata + 'keys.dat', 'wb') as configfile: shared.config.write(configfile) - sqlExecute('''DELETE FROM addressbook WHERE address=?''', address) - shared.UISignalQueue.put(('rerenderInboxFromLabels','')) - shared.UISignalQueue.put(('rerenderSentToLabels','')) - shared.UISignalQueue.put(('rerenderAddressBook','')) return 'success' elif method == 'deleteAddress': diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 910f73ff..bc2d80d5 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1297,7 +1297,6 @@ class MyForm(QtGui.QMainWindow): "MainWindow", "Could not add chan because it appears to already be one of your identities.")) return createdAddress = addressGeneratorReturnValue[0] - self.addEntryToAddressBook(createdAddress, self.str_chan + ' ' + str(self.newChanDialogInstance.ui.lineEditChanNameCreate.text().toUtf8())) QMessageBox.about(self, _translate("MainWindow", "Success"), _translate( "MainWindow", "Successfully created chan. To let others join your chan, give them the chan name and this Bitmessage address: %1. This address also appears in 'Your Identities'.").arg(createdAddress)) self.ui.tabWidget.setCurrentIndex(3) @@ -1327,7 +1326,6 @@ class MyForm(QtGui.QMainWindow): "MainWindow", "Could not add chan because it appears to already be one of your identities.")) return createdAddress = addressGeneratorReturnValue[0] - self.addEntryToAddressBook(createdAddress, self.str_chan + ' ' + str(self.newChanDialogInstance.ui.lineEditChanNameJoin.text())) QMessageBox.about(self, _translate("MainWindow", "Success"), _translate( "MainWindow", "Successfully joined chan. ")) self.ui.tabWidget.setCurrentIndex(3) @@ -1637,7 +1635,8 @@ class MyForm(QtGui.QMainWindow): # Message might be to an address we own like a chan address. Let's look for that label. if shared.config.has_section(addressToLookup): toLabel = shared.config.get(addressToLookup, 'label') - toLabel = addressToLookup + if toLabel == '': + toLabel = addressToLookup self.ui.tableWidgetSent.item( i, 0).setText(unicode(toLabel, 'utf-8'))