blob: bdebc23b1e5aaca00e5670676ee59e34cff1f0a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require 'nickserver/request_handlers/base'
require 'nickserver/email_address'
require 'nickserver/nicknym/source'
module Nickserver
module RequestHandlers
class LeapEmailHandler < Base
def handle
source.query(email) if request.email && remote_email? && nicknym_email?
end
protected
def source
@source ||= Nicknym::Source.new
end
def remote_email?
!email.domain?(domain)
end
def nicknym_email?
source.available_for?(email.domain)
end
def email
@email ||= EmailAddress.new(request.email)
end
def domain
Config.domain || request.domain
end
end
end
end
|