class EventMachine::Protocols::SmtpServer
def process_data
it would be a nice idea to add it to the other user-code callbacks.
This was added to deal with a special case in a particular application, but
Unusually, we can deal with a Deferrable returned from the user application.
--
def process_data unless @state.include?(:rcpt) send_data "503 Operation sequence error\r\n" else succeeded = proc { send_data "354 Send it\r\n" @state << :data @databuffer = [] } failed = proc { send_data "550 Operation failed\r\n" } d = receive_data_command if d.respond_to?(:callback) d.callback(&succeeded) d.errback(&failed) else (d ? succeeded : failed).call end end end