we no longer need to add chans to our address book

This commit is contained in:
Jonathan Warren 2013-11-02 00:02:46 -04:00
parent 6abb589f01
commit a4b5ded803
2 changed files with 3 additions and 23 deletions

View File

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

View File

@ -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,6 +1635,7 @@ 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')
if toLabel == '':
toLabel = addressToLookup
self.ui.tableWidgetSent.item(
i, 0).setText(unicode(toLabel, 'utf-8'))