From ca031dc4213186aba3563c156196bfae0e49d3f6 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Wed, 17 Aug 2016 22:02:41 +0200 Subject: [PATCH] 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" --- src/bitmessageqt/__init__.py | 14 ++++++++------ src/namecoin.py | 8 ++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index db56d0c7..ccb9e97f 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -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] diff --git a/src/namecoin.py b/src/namecoin.py index da65ce6c..ed98b4e3 100644 --- a/src/namecoin.py +++ b/src/namecoin.py @@ -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