ECXPLogon.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 ECXPLOGON_H
  18. #define ECXPLOGON_H
  19. #include <kopano/zcdefs.h>
  20. #include <condition_variable>
  21. #include <mutex>
  22. #include <kopano/ECUnknown.h>
  23. #include "IMAPIOffline.h"
  24. #include <string>
  25. /* struct MAILBOX_INFO {
  26. std::string strFullName;
  27. };
  28. typedef struct MAILBOX_INFO LPMAILBOX_INFO*;
  29. */
  30. class ECXPProvider;
  31. class ECXPLogon _kc_final : public ECUnknown {
  32. protected:
  33. ECXPLogon(const std::string &strProfileName, BOOL bOffline, ECXPProvider *lpXPProvider, LPMAPISUP lpMAPISup);
  34. virtual ~ECXPLogon();
  35. public:
  36. static HRESULT Create(const std::string &strProfileName, BOOL bOffline, ECXPProvider *lpXPProvider, LPMAPISUP lpMAPISup, ECXPLogon **lppECXPLogon);
  37. virtual HRESULT QueryInterface(REFIID refiid, void **lppInterface) _kc_override;
  38. virtual HRESULT AddressTypes(ULONG * lpulFlags, ULONG * lpcAdrType, LPTSTR ** lpppszAdrTypeArray, ULONG * lpcMAPIUID, LPMAPIUID ** lpppUIDArray);
  39. virtual HRESULT RegisterOptions(ULONG * lpulFlags, ULONG * lpcOptions, LPOPTIONDATA * lppOptions);
  40. virtual HRESULT TransportNotify(ULONG * lpulFlags, LPVOID * lppvData);
  41. virtual HRESULT Idle(ULONG ulFlags);
  42. virtual HRESULT TransportLogoff(ULONG ulFlags);
  43. virtual HRESULT SubmitMessage(ULONG ulFlags, LPMESSAGE lpMessage, ULONG * lpulMsgRef, ULONG * lpulReturnParm);
  44. virtual HRESULT EndMessage(ULONG ulMsgRef, ULONG * lpulFlags);
  45. virtual HRESULT Poll(ULONG * lpulIncoming);
  46. virtual HRESULT StartMessage(ULONG ulFlags, LPMESSAGE lpMessage, ULONG * lpulMsgRef);
  47. virtual HRESULT OpenStatusEntry(LPCIID lpInterface, ULONG ulFlags, ULONG * lpulObjType, LPMAPISTATUS * lppEntry);
  48. virtual HRESULT ValidateState(ULONG ulUIParam, ULONG ulFlags);
  49. virtual HRESULT FlushQueues(ULONG ulUIParam, ULONG cbTargetTransport, LPENTRYID lpTargetTransport, ULONG ulFlags);
  50. class xXPLogon _kc_final : public IXPLogon {
  51. #include <kopano/xclsfrag/IUnknown.hpp>
  52. // <kopano/xclsfrag/IXPLogon.hpp>
  53. virtual HRESULT __stdcall AddressTypes(ULONG *flags, ULONG *lpcAdrType, LPTSTR **lpppszAdrTypeArray, ULONG *lpcMAPIUID, LPMAPIUID **lpppUIDArray) _kc_override;
  54. virtual HRESULT __stdcall RegisterOptions(ULONG *flags, ULONG *lpcOptions, LPOPTIONDATA *lppOptions) _kc_override;
  55. virtual HRESULT __stdcall TransportNotify(ULONG *flags, LPVOID *lppvData) _kc_override;
  56. virtual HRESULT __stdcall Idle(ULONG flags) _kc_override;
  57. virtual HRESULT __stdcall TransportLogoff(ULONG flags) _kc_override;
  58. virtual HRESULT __stdcall SubmitMessage(ULONG flags, LPMESSAGE lpMessage, ULONG *lpulMsgRef, ULONG *lpulReturnParm) _kc_override;
  59. virtual HRESULT __stdcall EndMessage(ULONG ulMsgRef, ULONG *flags) _kc_override;
  60. virtual HRESULT __stdcall Poll(ULONG *lpulIncoming) _kc_override;
  61. virtual HRESULT __stdcall StartMessage(ULONG flags, LPMESSAGE lpMessage, ULONG *lpulMsgRef) _kc_override;
  62. virtual HRESULT __stdcall OpenStatusEntry(LPCIID lpInterface, ULONG flags, ULONG *lpulObjType, LPMAPISTATUS *lppEntry) _kc_override;
  63. virtual HRESULT __stdcall ValidateState(ULONG ui_param, ULONG flags) _kc_override;
  64. virtual HRESULT __stdcall FlushQueues(ULONG ui_param, ULONG cbTargetTransport, LPENTRYID lpTargetTransport, ULONG flags) _kc_override;
  65. } m_xXPLogon;
  66. private:
  67. class xMAPIAdviseSink _kc_final : public IMAPIAdviseSink {
  68. public:
  69. #include <kopano/xclsfrag/IUnknown.hpp>
  70. // <kopano/xclsfrag/IMAPIAdviseSink.hpp>
  71. ULONG __stdcall OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifs) _kc_override;
  72. } m_xMAPIAdviseSink;
  73. ULONG OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifs);
  74. HRESULT HrUpdateTransportStatus();
  75. HRESULT SetOutgoingProps (LPMESSAGE lpMessage);
  76. HRESULT ClearOldSubmittedMessages(LPMAPIFOLDER lpFolder);
  77. private:
  78. LPMAPISUP m_lpMAPISup;
  79. TCHAR **m_lppszAdrTypeArray = nullptr;
  80. ULONG m_ulTransportStatus = 0;
  81. ECXPProvider *m_lpXPProvider;
  82. bool m_bCancel = false;
  83. std::condition_variable m_hExitSignal;
  84. std::mutex m_hExitMutex;
  85. ULONG m_bOffline;
  86. };
  87. #endif // #ifndef ECXPLOGON_H