ClientProto.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef GATEWAY_COMMON_H
  18. #define GATEWAY_COMMON_H
  19. #include <kopano/zcdefs.h>
  20. #include <string>
  21. #include <kopano/ECChannel.h>
  22. #include <kopano/ECLogger.h>
  23. #include <kopano/ECConfig.h>
  24. #define LOGIN_RETRIES 5
  25. class ClientProto {
  26. public:
  27. ClientProto(const char *szServerPath, ECChannel *lpChannel, ECLogger *lpLogger, ECConfig *lpConfig) :
  28. m_strPath(szServerPath), lpChannel(lpChannel), lpLogger(lpLogger), lpConfig(lpConfig), m_ulFailedLogins(0)
  29. {};
  30. virtual ~ClientProto(void) _kc_impdtor;
  31. virtual int getTimeoutMinutes() = 0;
  32. virtual bool isContinue() const { return false; }; // imap only
  33. virtual HRESULT HrSendGreeting(const std::string &strHostString) = 0;
  34. virtual HRESULT HrCloseConnection(const std::string &strQuitMsg) = 0;
  35. virtual HRESULT HrProcessCommand(const std::string &strInput) = 0;
  36. virtual HRESULT HrProcessContinue(const std::string &strInput) { return MAPI_E_NO_SUPPORT; }; // imap only
  37. virtual HRESULT HrDone(bool bSendResponse) = 0;
  38. protected:
  39. std::string m_strPath;
  40. ECChannel *lpChannel;
  41. ECLogger *lpLogger;
  42. ECConfig *lpConfig;
  43. ULONG m_ulFailedLogins;
  44. };
  45. #endif