#ifndef __IMAPSession_h__
# define __IMAPSession_h__

# define CRLF "\r\n"

namespace mail {
   
   class IMAPSession : public core::TCPSession {

    public:      
      IMAPSession(core::EPoll &ePoll, core::TCPServer &server)
	: TCPSession(ePoll, server, "IMAP Client Session") {}

      enum State { NOT_AUTHENTICATED, AUTHENTICATED, SELECTED };

      std::string clientDomainName;
      std::string userName;
      std::string password;
      State state = NOT_AUTHENTICATED;      

      void onConnected() override {
	 out << "* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot (Ubuntu) ready." << CRLF;	   
      }      
      
   };
   
}

#endif
