summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/nickserver/request_handler.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/nickserver/request_handler.rb b/lib/nickserver/request_handler.rb
index 608db83..bc6d519 100644
--- a/lib/nickserver/request_handler.rb
+++ b/lib/nickserver/request_handler.rb
@@ -10,14 +10,14 @@ module Nickserver
end
def respond_to(params, headers)
- email = get_email_from_params(params)
- if email.nil?
- send_not_found
- elsif email.invalid?
- send_error("Not a valid address")
+ if params && params["address"] && params["address"].any?
+ by_email(params, headers)
+ elsif params && params["fingerprint"] && params["fingerprint"].any?
+ # do something else
else
- send_key(email, headers)
+ send_not_found
end
+
rescue RuntimeError => exc
puts "Error: #{exc}"
puts exc.backtrace
@@ -26,12 +26,17 @@ module Nickserver
protected
- def get_email_from_params(params)
- if params && params["address"] && params["address"].any?
- EmailAddress.new(params["address"].first)
+ def by_email(params, headers)
+ email = EmailAddress.new(params["address"].first)
+ if email.invalid?
+ send_error("Not a valid address")
+ else
+ send_key(email, headers)
end
end
+ #def by_fingerprint(params)
+
def send_key(email, headers)
if local_address?(email, headers)
source = Nickserver::CouchDB::Source.new(adapter)