More namecoin fixes

- namecoin lookup now also includes name of the record in the recipient
  field
- namecoin lookups now support multiple semicolon-separated
  recipients like the other recipient-related functions. If there are
  multiple recipients, namecoin lookup will look up the last entry on
  the line, for example if you have "a; b; c" in the recipient line,
  it will lookup "c"
This commit is contained in:
Peter Šurda 2016-08-17 22:02:41 +02:00
parent 29abf0fa08
commit ca031dc421
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 14 additions and 8 deletions

View File

@ -2135,12 +2135,14 @@ class MyForm(settingsmixin.SMainWindow):
def click_pushButtonFetchNamecoinID(self):
nc = namecoinConnection()
err, addr = nc.query(str(self.ui.lineEditTo.text()))
identities = str(self.ui.lineEditTo.text().toUtf8()).split(";")
err, addr = nc.query(identities[-1].strip())
if err is not None:
self.statusBar().showMessage(_translate(
"MainWindow", "Error: " + err))
else:
self.ui.lineEditTo.setText(addr)
identities[-1] = addr
self.ui.lineEditTo.setText("; ".join(identities))
self.statusBar().showMessage(_translate(
"MainWindow", "Fetched address from namecoin identity."))
@ -4137,10 +4139,10 @@ class settingsDialog(QtGui.QDialog):
"MainWindow", "Testing..."))
options = {}
options["type"] = self.getNamecoinType()
options["host"] = self.ui.lineEditNamecoinHost.text()
options["port"] = self.ui.lineEditNamecoinPort.text()
options["user"] = self.ui.lineEditNamecoinUser.text()
options["password"] = self.ui.lineEditNamecoinPassword.text()
options["host"] = str(self.ui.lineEditNamecoinHost.text().toUtf8())
options["port"] = str(self.ui.lineEditNamecoinPort.text().toUtf8())
options["user"] = str(self.ui.lineEditNamecoinUser.text().toUtf8())
options["password"] = str(self.ui.lineEditNamecoinPassword.text().toUtf8())
nc = namecoinConnection(options)
response = nc.test()
responseStatus = response[0]

View File

@ -118,7 +118,11 @@ class namecoinConnection (object):
return (tr._translate("MainWindow",'The name %1 has no valid JSON data.').arg(unicode(string)), None)
if "bitmessage" in val:
return (None, val["bitmessage"])
if "name" in val:
ret = "%s <%s>" % (val["name"], val["bitmessage"])
else:
ret = val["bitmessage"]
return (None, ret)
return (tr._translate("MainWindow",'The name %1 has no associated Bitmessage address.').arg(unicode(string)), None)
# Test the connection settings. This routine tries to query a "getinfo"
@ -206,7 +210,7 @@ class namecoinConnection (object):
except:
logger.error("HTTP receive error")
except:
logger.error("HTTP connection error")
logger.error("HTTP connection error", exc_info=True)
return result