class EventMachine::Protocols::SmtpServer

def process_auth_line(line)

def process_auth_line(line)
  plain = line.unpack("m").first
  _,user,psw = plain.split("\000")
  
  succeeded = proc {
    send_data "235 authentication ok\r\n"
    @state << :auth
  }
  failed = proc {
    send_data "535 invalid authentication\r\n"
  }
  auth = receive_plain_auth user,psw
  
  if auth.respond_to?(:callback)
    auth.callback(&succeeded)
    auth.errback(&failed)
  else
    (auth ? succeeded : failed).call
  end
  
  @state.delete :auth_incomplete
end