we no longer need to add chans to our address book
This commit is contained in:
parent
6abb589f01
commit
a4b5ded803
|
@ -415,14 +415,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
if len(queueReturn) == 0:
|
if len(queueReturn) == 0:
|
||||||
raise APIError(24, 'Chan address is already present.')
|
raise APIError(24, 'Chan address is already present.')
|
||||||
address = queueReturn[0]
|
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
|
return address
|
||||||
elif method == 'joinChan':
|
elif method == 'joinChan':
|
||||||
if len(params) < 2:
|
if len(params) < 2:
|
||||||
|
@ -450,14 +442,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
raise APIError(18, 'Chan name does not match address.')
|
raise APIError(18, 'Chan name does not match address.')
|
||||||
if len(addressGeneratorReturnValue) == 0:
|
if len(addressGeneratorReturnValue) == 0:
|
||||||
raise APIError(24, 'Chan address is already present.')
|
raise APIError(24, 'Chan address is already present.')
|
||||||
createdAddress = addressGeneratorReturnValue[0]
|
createdAddress = addressGeneratorReturnValue[0] # in case we ever want it for anything.
|
||||||
#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',''))
|
|
||||||
return "success"
|
return "success"
|
||||||
elif method == 'leaveChan':
|
elif method == 'leaveChan':
|
||||||
if len(params) == 0:
|
if len(params) == 0:
|
||||||
|
@ -473,10 +458,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
shared.config.remove_section(address)
|
shared.config.remove_section(address)
|
||||||
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
||||||
shared.config.write(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'
|
return 'success'
|
||||||
|
|
||||||
elif method == 'deleteAddress':
|
elif method == 'deleteAddress':
|
||||||
|
|
|
@ -1297,7 +1297,6 @@ class MyForm(QtGui.QMainWindow):
|
||||||
"MainWindow", "Could not add chan because it appears to already be one of your identities."))
|
"MainWindow", "Could not add chan because it appears to already be one of your identities."))
|
||||||
return
|
return
|
||||||
createdAddress = addressGeneratorReturnValue[0]
|
createdAddress = addressGeneratorReturnValue[0]
|
||||||
self.addEntryToAddressBook(createdAddress, self.str_chan + ' ' + str(self.newChanDialogInstance.ui.lineEditChanNameCreate.text().toUtf8()))
|
|
||||||
QMessageBox.about(self, _translate("MainWindow", "Success"), _translate(
|
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))
|
"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)
|
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."))
|
"MainWindow", "Could not add chan because it appears to already be one of your identities."))
|
||||||
return
|
return
|
||||||
createdAddress = addressGeneratorReturnValue[0]
|
createdAddress = addressGeneratorReturnValue[0]
|
||||||
self.addEntryToAddressBook(createdAddress, self.str_chan + ' ' + str(self.newChanDialogInstance.ui.lineEditChanNameJoin.text()))
|
|
||||||
QMessageBox.about(self, _translate("MainWindow", "Success"), _translate(
|
QMessageBox.about(self, _translate("MainWindow", "Success"), _translate(
|
||||||
"MainWindow", "Successfully joined chan. "))
|
"MainWindow", "Successfully joined chan. "))
|
||||||
self.ui.tabWidget.setCurrentIndex(3)
|
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.
|
# Message might be to an address we own like a chan address. Let's look for that label.
|
||||||
if shared.config.has_section(addressToLookup):
|
if shared.config.has_section(addressToLookup):
|
||||||
toLabel = shared.config.get(addressToLookup, 'label')
|
toLabel = shared.config.get(addressToLookup, 'label')
|
||||||
|
if toLabel == '':
|
||||||
toLabel = addressToLookup
|
toLabel = addressToLookup
|
||||||
self.ui.tableWidgetSent.item(
|
self.ui.tableWidgetSent.item(
|
||||||
i, 0).setText(unicode(toLabel, 'utf-8'))
|
i, 0).setText(unicode(toLabel, 'utf-8'))
|
||||||
|
|
Reference in New Issue
Block a user