diff options
author | azul <azul@riseup.net> | 2016-07-21 19:25:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 19:25:38 +0200 |
commit | 6663a070f6b34d5af4c1812b1255c64534a7a59a (patch) | |
tree | b01cf32a0a95a11b3ea9bd279c2b251a1fb5b58e /lib/nickserver/hkp/source.rb | |
parent | d7599715c6d24534dcccbe29cfc058e534039053 (diff) | |
parent | 59263baee9fc04524c8a69af1f7293fa4315d3ff (diff) |
Merge pull request #6 from pixelated/by_fingerprint
By fingerprint
Diffstat (limited to 'lib/nickserver/hkp/source.rb')
-rw-r--r-- | lib/nickserver/hkp/source.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/nickserver/hkp/source.rb b/lib/nickserver/hkp/source.rb index 0d79856..e104aa8 100644 --- a/lib/nickserver/hkp/source.rb +++ b/lib/nickserver/hkp/source.rb @@ -18,7 +18,7 @@ module Nickserver; module Hkp status, response = search(nick) if status == 200 best = pick_best_key(response) - get_key_by_fingerprint(nick, best.keyid) + get_key_by_fingerprint(best.keyid, nick) else Nickserver::Response.new(status, response) end @@ -30,6 +30,15 @@ module Nickserver; module Hkp return parser.status_for(nick), parser.response_for(nick) end + def get_key_by_fingerprint(fingerprint, nick = nil) + status, response = client.get_key_by_fingerprint fingerprint + if status == 200 + Response.new nick, response + else + Nickserver::Response.new status, "HKP Request failed" + end + end + protected # @@ -42,15 +51,6 @@ module Nickserver; module Hkp key_info_list.sort {|a,b| a.creationdate <=> b.creationdate}.last end - def get_key_by_fingerprint(nick, fingerprint) - status, response = client.get_key_by_fingerprint fingerprint - if status == 200 - Response.new nick, response - else - Nickserver::Response.new status, "HKP Request failed" - end - end - def client @client ||= Client.new(adapter) end |