summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-06-15 10:36:25 +0200
committerAzul <azul@riseup.net>2016-06-15 10:36:25 +0200
commit93258bd6fe6247e7af67f423243eba9808e920ee (patch)
tree559b3998465248138b6f24a76b6b3e55e60f3986 /lib
parent48502085e5aa7a1d8d430fc1dd4913f34e818afa (diff)
we don't need FetchKeyInfo anymore including in Source
Diffstat (limited to 'lib')
-rw-r--r--lib/nickserver.rb4
-rw-r--r--lib/nickserver/hkp/fetch_key_info.rb30
-rw-r--r--lib/nickserver/hkp/source.rb12
3 files changed, 11 insertions, 35 deletions
diff --git a/lib/nickserver.rb b/lib/nickserver.rb
index 16f7e85..8843acd 100644
--- a/lib/nickserver.rb
+++ b/lib/nickserver.rb
@@ -3,9 +3,5 @@ require "nickserver/version"
require "nickserver/config"
require "nickserver/email_address"
-require "nickserver/hkp/fetch_key_info"
-require "nickserver/hkp/parse_key_info"
-require "nickserver/hkp/key_info"
-
require "nickserver/server"
require "nickserver/daemon"
diff --git a/lib/nickserver/hkp/fetch_key_info.rb b/lib/nickserver/hkp/fetch_key_info.rb
deleted file mode 100644
index b8685bc..0000000
--- a/lib/nickserver/hkp/fetch_key_info.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'nickserver/hkp/client'
-
-#
-# used to fetch an array of KeyInfo objects that match the given uid.
-#
-
-module Nickserver; module Hkp
- class FetchKeyInfo
-
- def initialize(adapter)
- @adapter = adapter
- end
-
- def search(uid, &block)
- client.get_key_infos_by_email(uid) do |status, response|
- parser = ParseKeyInfo.new status, response
- yield parser.status_for(uid), parser.response_for(uid)
- end
- end
-
- protected
- attr_reader :adapter
-
- def client
- @client ||= Client.new(adapter)
- end
-
- end
-
-end; end
diff --git a/lib/nickserver/hkp/source.rb b/lib/nickserver/hkp/source.rb
index cbff91a..cae3e01 100644
--- a/lib/nickserver/hkp/source.rb
+++ b/lib/nickserver/hkp/source.rb
@@ -1,6 +1,9 @@
require 'nickserver/response'
require 'nickserver/hkp/response'
require 'nickserver/hkp/client'
+require "nickserver/hkp/parse_key_info"
+require "nickserver/hkp/key_info"
+
#
# Fetch keys via HKP
@@ -15,7 +18,7 @@ module Nickserver; module Hkp
end
def query(nick, &block)
- FetchKeyInfo.new(adapter).search(nick) do |status, response|
+ search(nick) do |status, response|
if status == 200
best = pick_best_key(response)
get_key_by_fingerprint(nick, best.keyid, &block)
@@ -25,6 +28,13 @@ module Nickserver; module Hkp
end
end
+ def search(nick, &block)
+ client.get_key_infos_by_email(nick) do |status, response|
+ parser = ParseKeyInfo.new status, response
+ yield parser.status_for(nick), parser.response_for(nick)
+ end
+ end
+
protected
attr_reader :adapter