ZCABContainer.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 ZCABCONTAINER_H
  18. #define ZCABCONTAINER_H
  19. #include <kopano/zcdefs.h>
  20. #include <mapispi.h>
  21. #include <mapidefs.h>
  22. #include "ZCABLogon.h"
  23. #include "ZCABData.h"
  24. #include "ZCMAPIProp.h"
  25. /* should be derived from IMAPIProp, but since we don't do anything with those functions, let's skip the red tape. */
  26. class ZCABContainer _kc_final : public ECUnknown {
  27. protected:
  28. ZCABContainer(std::vector<zcabFolderEntry> *lpFolders, IMAPIFolder *lpContacts, LPMAPISUP lpMAPISup, void *lpProvider, const char *szClassName);
  29. virtual ~ZCABContainer();
  30. private:
  31. HRESULT MakeWrappedEntryID(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulObjType, ULONG ulOffset, ULONG *lpcbEntryID, LPENTRYID *lppEntryID);
  32. public:
  33. static HRESULT Create(std::vector<zcabFolderEntry> *lpFolders, IMAPIFolder *lpContacts, LPMAPISUP lpMAPISup, void* lpProvider, ZCABContainer **lppABContainer);
  34. static HRESULT Create(IMessage *lpContact, ULONG cbEntryID, LPENTRYID lpEntryID, LPMAPISUP lpMAPISup, ZCABContainer **lppABContainer);
  35. HRESULT GetFolderContentsTable(ULONG ulFlags, LPMAPITABLE *lppTable);
  36. HRESULT GetDistListContentsTable(ULONG ulFlags, LPMAPITABLE *lppTable);
  37. // IUnknown
  38. virtual HRESULT QueryInterface(REFIID refiid, void **lppInterface) _kc_override;
  39. // IABContainer
  40. virtual HRESULT CreateEntry(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulCreateFlags, LPMAPIPROP* lppMAPIPropEntry);
  41. virtual HRESULT CopyEntries(LPENTRYLIST lpEntries, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags);
  42. virtual HRESULT DeleteEntries(LPENTRYLIST lpEntries, ULONG ulFlags);
  43. virtual HRESULT ResolveNames(const SPropTagArray *lpPropTagArray, ULONG ulFlags, LPADRLIST lpAdrList, LPFlagList lpFlagList);
  44. // From IMAPIContainer
  45. virtual HRESULT GetContentsTable(ULONG ulFlags, LPMAPITABLE *lppTable);
  46. virtual HRESULT GetHierarchyTable(ULONG ulFlags, LPMAPITABLE *lppTable);
  47. virtual HRESULT OpenEntry(ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG *lpulObjType, LPUNKNOWN *lppUnk);
  48. virtual HRESULT SetSearchCriteria(LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags);
  49. virtual HRESULT GetSearchCriteria(ULONG ulFlags, LPSRestriction *lppRestriction, LPENTRYLIST *lppContainerList, ULONG *lpulSearchState);
  50. // very limited IMAPIProp, passed to ZCMAPIProp for m_lpDistList.
  51. virtual HRESULT GetProps(const SPropTagArray *lpPropTagArray, ULONG ulFlags, ULONG *lpcValues, LPSPropValue *lppPropArray);
  52. virtual HRESULT GetPropList(ULONG ulFlags, LPSPropTagArray *lppPropTagArray);
  53. private:
  54. class xABContainer _kc_final : public IABContainer {
  55. #include <kopano/xclsfrag/IUnknown.hpp>
  56. // <kopano/xclsfrag/IDistList.hpp>
  57. #include <kopano/xclsfrag/IABContainer.hpp>
  58. #include <kopano/xclsfrag/IMAPIContainer.hpp>
  59. #include <kopano/xclsfrag/IMAPIProp.hpp> /* mostly MAPI_E_NO_SUPPORT */
  60. } m_xABContainer;
  61. private:
  62. /* reference to ZCABLogon .. ZCABLogon needs to live because of this, so AddChild */
  63. std::vector<zcabFolderEntry> *m_lpFolders;
  64. IMAPIFolder *m_lpContactFolder;
  65. LPMAPISUP m_lpMAPISup;
  66. void *m_lpProvider;
  67. /* distlist version of this container */
  68. IMAPIProp *m_lpDistList = nullptr;
  69. };
  70. #endif