Domob1812 namecoin id2 #409

Merged
Atheros1 merged 19 commits from domob1812-namecoin-id2 into master 2013-08-15 01:19:20 +02:00
2 changed files with 28 additions and 1 deletions
Showing only changes of commit 19331b641a - Show all commits

View File

@ -14,6 +14,7 @@ except ImportError:
from addresses import *
import shared
from bitmessageui import *
from class_namecoin import *
from newaddressdialog import *
from newsubscriptiondialog import *
from regenerateaddresses import *
@ -1457,7 +1458,13 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "Right click one or more entries in your address book and select \'Send message to this address\'."))
def click_pushButtonFetchNamecoinID(self):
self.ui.lineEditTo.setText ("BM-Foobar")
nc = namecoinConnection()
err, addr = nc.query("")
if err is not None:
self.statusBar().showMessage(_translate(
"MainWindow", "Error: " + err))
else:
self.ui.lineEditTo.setText(addr)
def redrawLabelFrom(self, index):
self.ui.labelFrom.setText(

20
src/class_namecoin.py Normal file
View File

@ -0,0 +1,20 @@
from jsonrpc import ServiceProxy, JSONRPCException
# This class handles the Namecoin identity integration.
class namecoinConnection(object):
def __init__(self):
user = "daniel"
password = "password"
host = "localhost"
port = "8336"
self.s = ServiceProxy ("http://" + user + ":" + password
+ "@" + host + ":" + port)
# Query for the bitmessage address corresponding to the given identity
# string. If it doesn't contain a slash, id/ is prepended. We return
# the result as (Error, Address) pair, where the Error is an error
# message to display or None in case of success.
def query(self,string):
return None, "BM-Foobar2"