tsimplification - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 605792601621e221d4bb879528fafd6aec21952c DIR parent 277c065d39a39e46d5c0edb8271fe54580176ba0 HTML Author: thomasv <thomasv@gitorious> Date: Tue, 14 Feb 2012 13:49:05 +0100 simplification Diffstat: M client/gui.py | 28 +--------------------------- M client/gui_qt.py | 27 +-------------------------- M client/wallet.py | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 54 deletions(-) --- DIR diff --git a/client/gui.py b/client/gui.py t@@ -696,34 +696,8 @@ class ElectrumWindow: def set_url(self, url): - - payto, amount, label, message, signature, identity, url = self.wallet.parse_url(url) + payto, amount, label, message, signature, identity, url = self.wallet.parse_url(url, self.show_message, self.question) self.notebook.set_current_page(1) - - if signature: - if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', identity): - signing_address = self.wallet.get_alias(identity, True, self.show_message, self.question) - elif self.wallet.is_valid(identity): - signing_address = identity - else: - signing_address = None - if not signing_address: - return - try: - self.wallet.verify_message(signing_address, signature, url ) - self.wallet.receipt = (signing_address, signature, url) - except: - self.show_message('Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.') - payto = amount = label = identity = message = '' - - # redundant with aliases - #if label and payto: - # self.labels[payto] = label - if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', payto): - payto_address = self.wallet.get_alias(payto, True, self.show_message, self.question) - if payto_address: - payto = payto + ' <' + payto_address + '>' - self.payto_entry.set_text(payto) self.message_entry.set_text(message) self.amount_entry.set_text(amount) DIR diff --git a/client/gui_qt.py b/client/gui_qt.py t@@ -328,33 +328,8 @@ class ElectrumWindow(QMainWindow): def set_url(self, url): - payto, amount, label, message, signature, identity, url = self.wallet.parse_url(url) + payto, amount, label, message, signature, identity, url = self.wallet.parse_url(url, self.show_message, self.question) self.tabs.setCurrentIndex(1) - - if signature: - if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', identity): - signing_address = self.wallet.get_alias(identity, True, self.show_message, self.question) - elif self.wallet.is_valid(identity): - signing_address = identity - else: - signing_address = None - if not signing_address: - return - try: - self.wallet.verify_message(signing_address, signature, url ) - self.wallet.receipt = (signing_address, signature, url) - except: - self.show_message('Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.') - payto = amount = label = identity = message = '' - - # redundant with aliases - #if label and payto: - # self.labels[payto] = label - if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', payto): - payto_address = self.wallet.get_alias(payto, True, self.show_message, self.question) - if payto_address: - payto = payto + ' <' + payto_address + '>' - self.payto_e.setText(payto) self.message_e.setText(message) self.amount_e.setText(amount) DIR diff --git a/client/wallet.py b/client/wallet.py t@@ -815,7 +815,7 @@ class Wallet: return target - def parse_url(self, url): + def parse_url(self, url, show_message, question): o = url[8:].split('?') address = o[0] if len(o)>1: t@@ -836,4 +836,25 @@ class Wallet: else: print k,v + if signature: + if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', identity): + signing_address = self.get_alias(identity, True, show_message, question) + elif self.is_valid(identity): + signing_address = identity + else: + signing_address = None + if not signing_address: + return + try: + self.verify_message(signing_address, signature, url ) + self.receipt = (signing_address, signature, url) + except: + self.show_message('Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.') + address = amount = label = identity = message = '' + + if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', address): + payto_address = self.get_alias(payto, True, show_message, question) + if payto_address: + address = address + ' <' + payto_address + '>' + return address, amount, label, message, signature, identity, url