mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
31 lines
598 B
Ruby
31 lines
598 B
Ruby
|
#
|
||
|
# Handles an incoming message
|
||
|
#
|
||
|
require_dependency 'email/incoming_message'
|
||
|
|
||
|
module Email
|
||
|
class Receiver
|
||
|
|
||
|
def self.results
|
||
|
@results ||= Enum.new(:unprocessable)
|
||
|
end
|
||
|
|
||
|
def initialize(incoming_message)
|
||
|
@incoming_message = incoming_message
|
||
|
end
|
||
|
|
||
|
def process
|
||
|
|
||
|
if @incoming_message.blank? || @incoming_message.reply_key.blank?
|
||
|
return Email::Receiver.results[:unprocessable]
|
||
|
end
|
||
|
|
||
|
log = EmailLog.where(reply_key: @incoming_message.reply_key).first
|
||
|
return Email::Receiver.results[:unprocessable] if log.blank?
|
||
|
|
||
|
nil
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|