ECExchangeImportContentsChanges.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 ECEXCHANGEIMPORTCONTENTSCHANGES_H
  18. #define ECEXCHANGEIMPORTCONTENTSCHANGES_H
  19. #include <kopano/zcdefs.h>
  20. #include <mapidefs.h>
  21. #include "ECMAPIFolder.h"
  22. #include <kopano/ECUnknown.h>
  23. #include <IECImportContentsChanges.h>
  24. namespace KC {
  25. class ECLogger;
  26. }
  27. class ECExchangeImportContentsChanges _kc_final : public ECUnknown {
  28. protected:
  29. ECExchangeImportContentsChanges(ECMAPIFolder *lpFolder);
  30. virtual ~ECExchangeImportContentsChanges();
  31. public:
  32. static HRESULT Create(ECMAPIFolder *lpFolder, LPEXCHANGEIMPORTCONTENTSCHANGES* lppExchangeImportContentsChanges);
  33. // IUnknown
  34. virtual HRESULT QueryInterface(REFIID refiid, void **lppInterface) _kc_override;
  35. // IExchangeImportContentsChanges
  36. virtual HRESULT GetLastError(HRESULT hResult, ULONG ulFlags, LPMAPIERROR *lppMAPIError);
  37. virtual HRESULT Config(LPSTREAM lpStream, ULONG ulFlags);
  38. virtual HRESULT UpdateState(LPSTREAM lpStream);
  39. virtual HRESULT ImportMessageChange(ULONG cValue, LPSPropValue lpPropArray, ULONG ulFlags, LPMESSAGE * lppMessage);
  40. virtual HRESULT ImportMessageDeletion(ULONG ulFlags, LPENTRYLIST lpSourceEntryList);
  41. virtual HRESULT ImportPerUserReadStateChange(ULONG cElements, LPREADSTATE lpReadState);
  42. virtual HRESULT ImportMessageMove(ULONG cbSourceKeySrcFolder, BYTE *pbSourceKeySrcFolder, ULONG cbSourceKeySrcMessage, BYTE *pbSourceKeySrcMessage, ULONG cbPCLMessage, BYTE *pbPCLMessage, ULONG cbSourceKeyDestMessage, BYTE *pbSourceKeyDestMessage, ULONG cbChangeNumDestMessage, BYTE *pbChangeNumDestMessage);
  43. // IECImportContentsChanges
  44. virtual HRESULT ConfigForConversionStream(LPSTREAM lpStream, ULONG ulFlags, ULONG cValuesConversion, LPSPropValue lpPropArrayConversion);
  45. virtual HRESULT ImportMessageChangeAsAStream(ULONG cValue, LPSPropValue lpPropArray, ULONG ulFlags, LPSTREAM *lppstream);
  46. virtual HRESULT SetMessageInterface(REFIID refiid);
  47. class xECImportContentsChanges _kc_final :
  48. public IECImportContentsChanges {
  49. #include <kopano/xclsfrag/IUnknown.hpp>
  50. // <kopano/xclsfrag/IExchangeImportContentsChanges.hpp>
  51. virtual HRESULT __stdcall GetLastError(HRESULT hResult, ULONG flags, LPMAPIERROR *lppMAPIError) _kc_override;
  52. virtual HRESULT __stdcall Config(LPSTREAM lpStream, ULONG flags) _kc_override;
  53. virtual HRESULT __stdcall UpdateState(LPSTREAM lpStream) _kc_override;
  54. virtual HRESULT __stdcall ImportMessageChange(ULONG cValue, LPSPropValue lpPropArray, ULONG flags, LPMESSAGE *lppMessage) _kc_override;
  55. virtual HRESULT __stdcall ImportMessageDeletion(ULONG flags, LPENTRYLIST lpSourceEntryList) _kc_override;
  56. virtual HRESULT __stdcall ImportPerUserReadStateChange(ULONG cElements, LPREADSTATE lpReadState) _kc_override;
  57. virtual HRESULT __stdcall ImportMessageMove(ULONG cbSourceKeySrcFolder, BYTE *pbSourceKeySrcFolder, ULONG cbSourceKeySrcMessage, BYTE *pbSourceKeySrcMessage, ULONG cbPCLMessage, BYTE *pbPCLMessage, ULONG cbSourceKeyDestMessage, BYTE *pbSourceKeyDestMessage, ULONG cbChangeNumDestMessage, BYTE *pbChangeNumDestMessage) _kc_override;
  58. // <kopano/xclsfrag/IECImportContentsChanges.hpp>
  59. virtual HRESULT __stdcall ConfigForConversionStream(LPSTREAM lpStream, ULONG flags, ULONG cValuesConversion, LPSPropValue lpPropArrayConversion) _kc_override;
  60. virtual HRESULT __stdcall ImportMessageChangeAsAStream(ULONG cValue, LPSPropValue lpPropArray, ULONG flags, LPSTREAM *lppstream) _kc_override;
  61. virtual HRESULT __stdcall SetMessageInterface(REFIID refiid) _kc_override;
  62. } m_xECImportContentsChanges;
  63. private:
  64. bool IsProcessed(const SPropValue *remote_ck, const SPropValue *local_pcl);
  65. bool IsConflict(const SPropValue *local_ck, const SPropValue *remote_pcl);
  66. HRESULT CreateConflictMessage(LPMESSAGE lpMessage);
  67. HRESULT CreateConflictMessageOnly(LPMESSAGE lpMessage, LPSPropValue *lppConflictItems);
  68. HRESULT CreateConflictFolders();
  69. HRESULT CreateConflictFolder(LPTSTR lpszName, LPSPropValue lpAdditionalREN, ULONG ulMVPos, LPMAPIFOLDER lpParentFolder, LPMAPIFOLDER * lppConflictFolder);
  70. HRESULT ImportMessageCreateAsStream(ULONG cValue, LPSPropValue lpPropArray, WSMessageStreamImporter **lppMessageImporter);
  71. HRESULT ImportMessageUpdateAsStream(ULONG cbEntryId, LPENTRYID lpEntryId, ULONG cValue, LPSPropValue lpPropArray, WSMessageStreamImporter **lppMessageImporter);
  72. static HRESULT HrUpdateSearchReminders(LPMAPIFOLDER lpRootFolder, const SPropValue *);
  73. friend class ECExchangeImportHierarchyChanges;
  74. ECLogger *m_lpLogger = nullptr;
  75. ECMAPIFolder *m_lpFolder = nullptr;
  76. SPropValue *m_lpSourceKey = nullptr;
  77. IStream *m_lpStream = nullptr;
  78. ULONG m_ulFlags = 0;
  79. ULONG m_ulSyncId = 0;
  80. ULONG m_ulChangeId = 0;
  81. IID m_iidMessage;
  82. };
  83. #endif // ECEXCHANGEIMPORTCONTENTSCHANGES_H