electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 5a76a0fc951371440216f4c7aab25f5b2f006ccd
parent bb7437e53448b7502b98ebe782621039418d27b4
Author: ThomasV <thomasv@gitorious>
Date:   Sun, 31 May 2015 14:42:16 +0200

hook openalias plugin to command line interface

Diffstat:
Mlib/util.py | 7++++++-
Mplugins/__init__.py | 2+-
Mplugins/openalias.py | 4++++
3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/util.py b/lib/util.py @@ -464,6 +464,7 @@ class StoreDict(dict): import bitcoin +from plugins import run_hook class Contacts(StoreDict): def __init__(self, config): @@ -474,6 +475,10 @@ class Contacts(StoreDict): return k if k in self.keys(): _type, addr = self[k] - return addr + if _type == 'address': + return addr + out = run_hook('resolve_address', k) + if out: + return out raise Exception("invalid Bitcoin address", k) diff --git a/plugins/__init__.py b/plugins/__init__.py @@ -73,7 +73,7 @@ descriptions = [ 'fullname': 'OpenAlias', 'description': _('Allow for payments to OpenAlias addresses.'), 'requires': [('dns', 'dnspython')], - 'available_for': ['qt'] + 'available_for': ['qt', 'cmdline'] }, { 'name': 'plot', diff --git a/plugins/openalias.py b/plugins/openalias.py @@ -179,6 +179,10 @@ class Plugin(BasePlugin): return bool(d.exec_()) + @hook + def resolve_address(self, url): + return self.resolve(url)[0] + def resolve(self, url): '''Resolve OpenAlias address using url.''' self.print_error('[OA] Attempting to resolve OpenAlias data for ' + url)