diff options
author | Azul <azul@riseup.net> | 2016-07-02 13:16:35 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-07-02 13:26:43 +0200 |
commit | e81c1a8cf274a13903be00c74c975c0cb2c20995 (patch) | |
tree | 5da2e0711420fde574d1091dcbdfcccaddf52256 /lib/nickserver/hkp/parse_key_info.rb | |
parent | fb2d7e6f8f1fceefbc8964d34369a867eb8f25bb (diff) |
refactor: turn EmailAddress into a class, cleanup
Diffstat (limited to 'lib/nickserver/hkp/parse_key_info.rb')
-rw-r--r-- | lib/nickserver/hkp/parse_key_info.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/nickserver/hkp/parse_key_info.rb b/lib/nickserver/hkp/parse_key_info.rb index 9d59d6b..2f928a0 100644 --- a/lib/nickserver/hkp/parse_key_info.rb +++ b/lib/nickserver/hkp/parse_key_info.rb @@ -19,7 +19,8 @@ module Nickserver; module Hkp @vindex_result = vindex_result end - def status_for(uid) + def status_for(email) + uid = email.to_s if hkp_ok? && keys(uid).empty? error_status(uid) else @@ -27,7 +28,8 @@ module Nickserver; module Hkp end end - def response_for(uid) + def response_for(email) + uid = email.to_s if keys(uid).any? keys(uid) else @@ -35,6 +37,8 @@ module Nickserver; module Hkp end end + protected + def keys(uid) key_infos(uid).reject { |key| error_for_key(key) } end @@ -47,8 +51,6 @@ module Nickserver; module Hkp end end - protected - attr_reader :status attr_reader :vindex_result |