ECMAPIProp.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 ECMAPIPROP_H
  18. #define ECMAPIPROP_H
  19. #include <kopano/zcdefs.h>
  20. #include "kcore.hpp"
  21. #include <kopano/IECSecurity.h>
  22. #include "ECGenericProp.h"
  23. // For HrSetFlags
  24. #define SET 1
  25. #define UNSET 2
  26. class ECMsgStore;
  27. class ECMAPIProp : public ECGenericProp {
  28. protected:
  29. ECMAPIProp(void *lpProvider, ULONG ulObjType, BOOL fModify, ECMAPIProp *lpRoot, const char *szClassName = NULL);
  30. virtual ~ECMAPIProp();
  31. public:
  32. /**
  33. * \brief Obtain a different interface to this object.
  34. *
  35. * See ECUnkown::QueryInterface.
  36. */
  37. virtual HRESULT QueryInterface(REFIID refiid, void **lppInterface) _kc_override;
  38. static HRESULT TableRowGetProp(void* lpProvider, struct propVal *lpsPropValSrc, LPSPropValue lpsPropValDst, void **lpBase, ULONG ulType);
  39. // Callback for Commit() on streams
  40. static HRESULT HrStreamCommit(IStream *lpStream, void *lpData);
  41. // Callback for ECMemStream delete local data
  42. static HRESULT HrStreamCleanup(void *lpData);
  43. static HRESULT DefaultMAPIGetProp(ULONG ulPropTag, void* lpProvider, ULONG ulFlags, LPSPropValue lpsPropValue, void *lpParam, void *lpBase);
  44. static HRESULT SetPropHandler(ULONG ulPropTag, void *lpProvider, const SPropValue *lpsPropValue, void *lpParam);
  45. // IMAPIProp override
  46. virtual HRESULT OpenProperty(ULONG ulPropTag, LPCIID lpiid, ULONG ulInterfaceOptions, ULONG ulFlags, LPUNKNOWN *lppUnk);
  47. virtual HRESULT SaveChanges(ULONG ulFlags);
  48. virtual HRESULT CopyTo(ULONG ciidExclude, LPCIID rgiidExclude, const SPropTagArray *lpExcludeProps, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, LPCIID lpInterface, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems);
  49. virtual HRESULT CopyProps(const SPropTagArray *lpIncludeProps, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, LPCIID lpInterface, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems);
  50. virtual HRESULT GetNamesFromIDs(LPSPropTagArray * pptaga, LPGUID lpguid, ULONG ulFlags, ULONG * pcNames, LPMAPINAMEID ** pppNames);
  51. virtual HRESULT GetIDsFromNames(ULONG cNames, LPMAPINAMEID * ppNames, ULONG ulFlags, LPSPropTagArray * pptaga);
  52. virtual HRESULT HrSetSyncId(ULONG ulSyncId);
  53. virtual HRESULT SetParentID(ULONG cbParentID, LPENTRYID lpParentID);
  54. virtual HRESULT SetICSObject(BOOL bICSObject);
  55. virtual BOOL IsICSObject();
  56. protected:
  57. HRESULT HrLoadProps();
  58. virtual HRESULT HrSaveChild(ULONG ulFlags, MAPIOBJECT *lpsMapiObject);
  59. HRESULT GetSerializedACLData(LPVOID lpBase, LPSPropValue lpsPropValue);
  60. HRESULT SetSerializedACLData(const SPropValue *lpsPropValue);
  61. HRESULT UpdateACLs(ULONG cNewPerms, ECPERMISSION *lpNewPerms);
  62. // IECServiceAdmin and IECSecurity
  63. virtual HRESULT GetUserList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ULONG *lpcUsers, ECUSER **lppsUsers);
  64. virtual HRESULT GetGroupList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ULONG *lpcGroups, ECGROUP **lppsGroups);
  65. virtual HRESULT GetCompanyList(ULONG ulFlags, ULONG *lpcCompanies, ECCOMPANY **lppsCompanies);
  66. // IECSecurity
  67. virtual HRESULT GetOwner(ULONG *lpcbOwner, LPENTRYID *lppOwner);
  68. virtual HRESULT GetPermissionRules(int ulType, ULONG* lpcPermissions, ECPERMISSION **lppECPermissions);
  69. virtual HRESULT SetPermissionRules(ULONG cPermissions, ECPERMISSION *lpECPermissions);
  70. public:
  71. ECMsgStore* GetMsgStore();
  72. class xMAPIProp _kc_final : public IMAPIProp {
  73. #include <kopano/xclsfrag/IUnknown.hpp>
  74. #include <kopano/xclsfrag/IMAPIProp.hpp>
  75. } m_xMAPIProp;
  76. class xECSecurity _kc_final : public IECSecurity {
  77. #include <kopano/xclsfrag/IUnknown.hpp>
  78. // <kopano/xclsfrag/IECSecurity.hpp>
  79. virtual HRESULT GetOwner(ULONG *lpcbOwner, LPENTRYID *lppOwner) _kc_override;
  80. virtual HRESULT GetPermissionRules(int ulType, ULONG *lpcPermissions, ECPERMISSION **lppECPermissions) _kc_override;
  81. virtual HRESULT SetPermissionRules(ULONG cPermissions, ECPERMISSION *lpECPermissions) _kc_override;
  82. virtual HRESULT GetUserList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG flags, ULONG *lpcUsers, ECUSER **lppsUsers) _kc_override;
  83. virtual HRESULT GetGroupList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG flags, ULONG *lpcGroups, ECGROUP **lppsGroups) _kc_override;
  84. virtual HRESULT GetCompanyList(ULONG flags, ULONG *lpcCompanies, ECCOMPANY **lppCompanies) _kc_override;
  85. } m_xECSecurity;
  86. private:
  87. BOOL m_bICSObject = false; // coming from the ICS system
  88. ULONG m_ulSyncId = 0, m_cbParentID = 0;
  89. ENTRYID *m_lpParentID = nullptr; // Overrides the parentid from the server
  90. public:
  91. ECMAPIProp *m_lpRoot; // Points to the 'root' object that was opened by OpenEntry; normally points to 'this' except for Attachments and Submessages
  92. };
  93. #endif // ECMAPIPROP_H