summaryrefslogtreecommitdiff
path: root/lib/nickserver/request_handlers/local_email_handler.rb
blob: 9165ef23c5421ef89cb3bf758f850fc48f3001f0 (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
require 'nickserver/request_handlers/base'
require 'nickserver/email_address'
require 'nickserver/couch_db/source'

module Nickserver
  module RequestHandlers
    class LocalEmailHandler < Base

      def handle
        source.query(email) if request.email && email.domain?(domain)
      end

      protected

      def domain
        Config.domain || request.domain
      end

      def email
        @email ||= EmailAddress.new(request.email)
      end

      def source
        Nickserver::CouchDB::Source.new
      end

    end
  end
end