ECArchiveAwareMessage.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 ECARCHIVEAWAREMESSAGE_H
  18. #define ECARCHIVEAWAREMESSAGE_H
  19. #include <kopano/zcdefs.h>
  20. #include <kopano/memory.hpp>
  21. #include "ECMessage.h"
  22. #include <kopano/CommonUtil.h>
  23. #include <string>
  24. class ECArchiveAwareMsgStore;
  25. class _kc_export_dycast ECArchiveAwareMessage _kc_final : public ECMessage {
  26. protected:
  27. /**
  28. * \param lpMsgStore The store owning this message.
  29. * \param fNew Specifies whether the message is a new message.
  30. * \param fModify Specifies whether the message is writable.
  31. * \param ulFlags Flags.
  32. */
  33. _kc_hidden ECArchiveAwareMessage(ECArchiveAwareMsgStore *, BOOL fNew, BOOL modify, ULONG flags);
  34. _kc_hidden virtual ~ECArchiveAwareMessage(void) _kc_impdtor;
  35. public:
  36. /**
  37. * \brief Creates a new ECMessage object.
  38. *
  39. * Use this static method to create a new ECMessage object.
  40. *
  41. * \param lpMsgStore The store owning this message.
  42. * \param fNew Specifies whether the message is a new message.
  43. * \param fModify Specifies whether the message is writable.
  44. * \param ulFlags Flags.
  45. * \param bEmbedded Specifies whether the message is embedded.
  46. *
  47. * \return hrSuccess on success.
  48. */
  49. _kc_hidden static HRESULT Create(ECArchiveAwareMsgStore *store, BOOL fNew, BOOL modify, ULONG flags, ECMessage **);
  50. _kc_hidden virtual HRESULT HrLoadProps(void);
  51. _kc_hidden virtual HRESULT HrSetRealProp(const SPropValue *);
  52. _kc_hidden virtual HRESULT OpenProperty(ULONG proptag, LPCIID lpiid, ULONG iface_opts, ULONG flags, LPUNKNOWN *);
  53. _kc_hidden virtual HRESULT OpenAttach(ULONG atnum, LPCIID iface, ULONG flags, LPATTACH *ret);
  54. _kc_hidden virtual HRESULT CreateAttach(LPCIID iface, ULONG flags, ULONG *atnum, LPATTACH *ret);
  55. _kc_hidden virtual HRESULT DeleteAttach(ULONG atnum, ULONG ui_param, LPMAPIPROGRESS, ULONG flags);
  56. _kc_hidden virtual HRESULT ModifyRecipients(ULONG flags, const ADRLIST *mods);
  57. _kc_hidden virtual HRESULT SaveChanges(ULONG flags);
  58. _kc_hidden static HRESULT SetPropHandler(ULONG proptag, void *prov, const SPropValue *, void *param);
  59. _kc_hidden bool IsLoading(void) const { return m_bLoading; }
  60. protected:
  61. _kc_hidden virtual HRESULT HrDeleteRealProp(ULONG proptag, BOOL overwrite_ro);
  62. private:
  63. _kc_hidden HRESULT MapNamedProps(void);
  64. _kc_hidden HRESULT CreateInfoMessage(const SPropTagArray *deleteprop, const std::string &bodyhtml);
  65. _kc_hidden std::string CreateErrorBodyUtf8(HRESULT);
  66. _kc_hidden std::string CreateOfflineWarnBodyUtf8(void);
  67. bool m_bLoading;
  68. bool m_bNamedPropsMapped;
  69. PROPMAP_DECL()
  70. PROPMAP_DEF_NAMED_ID(ARCHIVE_STORE_ENTRYIDS)
  71. PROPMAP_DEF_NAMED_ID(ARCHIVE_ITEM_ENTRYIDS)
  72. PROPMAP_DEF_NAMED_ID(STUBBED)
  73. PROPMAP_DEF_NAMED_ID(DIRTY)
  74. PROPMAP_DEF_NAMED_ID(ORIGINAL_SOURCE_KEY)
  75. typedef KCHL::memory_ptr<SPropValue> SPropValuePtr;
  76. SPropValuePtr m_ptrStoreEntryIDs;
  77. SPropValuePtr m_ptrItemEntryIDs;
  78. enum eMode {
  79. MODE_UNARCHIVED, // Not archived
  80. MODE_ARCHIVED, // Archived and not stubbed
  81. MODE_STUBBED, // Archived and stubbed
  82. MODE_DIRTY // Archived and modified saved message
  83. };
  84. eMode m_mode;
  85. bool m_bChanged;
  86. typedef KCHL::object_ptr<ECMessage, IID_ECMessage> ECMessagePtr;
  87. ECMessagePtr m_ptrArchiveMsg;
  88. ALLOC_WRAP_FRIEND;
  89. };
  90. class ECArchiveAwareMessageFactory _kc_final : public IMessageFactory {
  91. public:
  92. HRESULT Create(ECMsgStore *lpMsgStore, BOOL fNew, BOOL fModify, ULONG ulFlags, BOOL bEmbedded, ECMAPIProp *lpRoot, ECMessage **lppMessage) const;
  93. };
  94. #endif // ndef ECARCHIVEAWAREMESSAGE_H