thook openalias plugin to command line interface - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 5a76a0fc951371440216f4c7aab25f5b2f006ccd (DIR) parent bb7437e53448b7502b98ebe782621039418d27b4 (HTM) Author: ThomasV <thomasv@gitorious> Date: Sun, 31 May 2015 14:42:16 +0200 hook openalias plugin to command line interface Diffstat: M lib/util.py | 7 ++++++- M plugins/__init__.py | 2 +- M plugins/openalias.py | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) --- (DIR) diff --git a/lib/util.py b/lib/util.py t@@ -464,6 +464,7 @@ class StoreDict(dict): import bitcoin +from plugins import run_hook class Contacts(StoreDict): def __init__(self, config): t@@ -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) (DIR) diff --git a/plugins/__init__.py b/plugins/__init__.py t@@ -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', (DIR) diff --git a/plugins/openalias.py b/plugins/openalias.py t@@ -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)