ECDistList.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #include <new>
  18. #include <kopano/platform.h>
  19. #include <kopano/ECInterfaceDefs.h>
  20. #include "kcore.hpp"
  21. #include "ECDistList.h"
  22. #include "Mem.h"
  23. #include <kopano/ECGuid.h>
  24. #include <kopano/CommonUtil.h>
  25. #include <kopano/ECDebug.h>
  26. #include "ECMAPITable.h"
  27. ECDistList::ECDistList(void* lpProvider, BOOL fModify) : ECABContainer(lpProvider, MAPI_DISTLIST, fModify, "IDistList")
  28. {
  29. // since we have no OpenProperty / abLoadProp, remove the 8k prop limit
  30. this->m_ulMaxPropSize = 0;
  31. }
  32. HRESULT ECDistList::QueryInterface(REFIID refiid, void **lppInterface)
  33. {
  34. REGISTER_INTERFACE2(ECDistList, this);
  35. REGISTER_INTERFACE2(ECABContainer, this);
  36. REGISTER_INTERFACE2(ECABProp, this);
  37. REGISTER_INTERFACE2(ECUnknown, this);
  38. REGISTER_INTERFACE2(IDistList, &this->m_xDistList);
  39. REGISTER_INTERFACE(IID_IABContainer, &this->m_xDistList);
  40. REGISTER_INTERFACE2(IMAPIProp, &this->m_xDistList);
  41. REGISTER_INTERFACE2(IUnknown, &this->m_xDistList);
  42. return MAPI_E_INTERFACE_NOT_SUPPORTED;
  43. }
  44. HRESULT ECDistList::Create(void* lpProvider, BOOL fModify, ECDistList** lppDistList)
  45. {
  46. return alloc_wrap<ECDistList>(lpProvider, fModify).as(IID_ECDistList, lppDistList);
  47. }
  48. HRESULT ECDistList::TableRowGetProp(void* lpProvider, struct propVal *lpsPropValSrc, LPSPropValue lpsPropValDst, void **lpBase, ULONG ulType)
  49. {
  50. return MAPI_E_NOT_FOUND;
  51. }
  52. HRESULT ECDistList::OpenProperty(ULONG ulPropTag, LPCIID lpiid, ULONG ulInterfaceOptions, ULONG ulFlags, LPUNKNOWN *lppUnk)
  53. {
  54. if (lpiid == NULL)
  55. return MAPI_E_INVALID_PARAMETER;
  56. return ECABProp::OpenProperty(ulPropTag, lpiid, ulInterfaceOptions, ulFlags, lppUnk);
  57. }
  58. HRESULT ECDistList::CopyTo(ULONG ciidExclude, LPCIID rgiidExclude,
  59. const SPropTagArray *lpExcludeProps, ULONG ulUIParam,
  60. LPMAPIPROGRESS lpProgress, LPCIID lpInterface, void *lpDestObj,
  61. ULONG ulFlags, SPropProblemArray **lppProblems)
  62. {
  63. return this->GetABStore()->m_lpMAPISup->DoCopyTo(&IID_IDistList, &this->m_xDistList, ciidExclude, rgiidExclude, lpExcludeProps, ulUIParam, lpProgress, lpInterface, lpDestObj, ulFlags, lppProblems);
  64. }
  65. HRESULT ECDistList::CopyProps(const SPropTagArray *lpIncludeProps,
  66. ULONG ulUIParam, LPMAPIPROGRESS lpProgress, LPCIID lpInterface,
  67. void *lpDestObj, ULONG ulFlags, SPropProblemArray **lppProblems)
  68. {
  69. return this->GetABStore()->m_lpMAPISup->DoCopyProps(&IID_IDistList, &this->m_xDistList, lpIncludeProps, ulUIParam, lpProgress, lpInterface, lpDestObj, ulFlags, lppProblems);
  70. }
  71. // Interface IUnknown
  72. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, QueryInterface, (REFIID, refiid), (void**, lppInterface))
  73. DEF_ULONGMETHOD1(TRACE_MAPI, ECDistList, DistList, AddRef, (void))
  74. DEF_ULONGMETHOD1(TRACE_MAPI, ECDistList, DistList, Release, (void))
  75. // Interface IABContainer
  76. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, CreateEntry, (ULONG, cbEntryID), (LPENTRYID, lpEntryID), (ULONG, ulCreateFlags), (LPMAPIPROP*, lppMAPIPropEntry))
  77. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, CopyEntries, (LPENTRYLIST, lpEntries), (ULONG, ulUIParam), (LPMAPIPROGRESS, lpProgress), (ULONG, ulFlags))
  78. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, DeleteEntries, (LPENTRYLIST, lpEntries), (ULONG, ulFlags))
  79. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, ResolveNames, (const SPropTagArray *, lpPropTagArray), (ULONG, ulFlags), (LPADRLIST, lpAdrList), (LPFlagList, lpFlagList))
  80. // Interface IMAPIContainer
  81. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetContentsTable, (ULONG, ulFlags), (LPMAPITABLE *, lppTable))
  82. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetHierarchyTable, (ULONG, ulFlags), (LPMAPITABLE *, lppTable))
  83. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, OpenEntry, (ULONG, cbEntryID), (LPENTRYID, lpEntryID), (LPCIID, lpInterface), (ULONG, ulFlags), (ULONG *, lpulObjType), (LPUNKNOWN *, lppUnk))
  84. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, SetSearchCriteria, (LPSRestriction, lpRestriction), (LPENTRYLIST, lpContainerList), (ULONG, ulSearchFlags))
  85. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetSearchCriteria, (ULONG, ulFlags), (LPSRestriction *, lppRestriction), (LPENTRYLIST *, lppContainerList), (ULONG *, lpulSearchState))
  86. // Interface IMAPIProp
  87. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetLastError, (HRESULT, hError), (ULONG, ulFlags), (LPMAPIERROR *, lppMapiError))
  88. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, SaveChanges, (ULONG, ulFlags))
  89. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetProps, (const SPropTagArray *, lpPropTagArray), (ULONG, ulFlags), (ULONG *, lpcValues), (SPropValue **, lppPropArray))
  90. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetPropList, (ULONG, ulFlags), (LPSPropTagArray *, lppPropTagArray))
  91. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, OpenProperty, (ULONG, ulPropTag), (LPCIID, lpiid), (ULONG, ulInterfaceOptions), (ULONG, ulFlags), (LPUNKNOWN *, lppUnk))
  92. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, SetProps, (ULONG, cValues), (const SPropValue *, lpPropArray), (SPropProblemArray **, lppProblems))
  93. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, DeleteProps, (const SPropTagArray *, lpPropTagArray), (SPropProblemArray **, lppProblems))
  94. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, CopyTo, (ULONG, ciidExclude), (LPCIID, rgiidExclude), (const SPropTagArray *, lpExcludeProps), (ULONG, ulUIParam), (LPMAPIPROGRESS, lpProgress), (LPCIID, lpInterface), (void *, lpDestObj), (ULONG, ulFlags), (SPropProblemArray **, lppProblems))
  95. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, CopyProps, (const SPropTagArray *, lpIncludeProps), (ULONG, ulUIParam), (LPMAPIPROGRESS, lpProgress), (LPCIID, lpInterface), (void *, lpDestObj), (ULONG, ulFlags), (SPropProblemArray **, lppProblems))
  96. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetNamesFromIDs, (LPSPropTagArray *, pptaga), (LPGUID, lpguid), (ULONG, ulFlags), (ULONG *, pcNames), (LPMAPINAMEID **, pppNames))
  97. DEF_HRMETHOD1(TRACE_MAPI, ECDistList, DistList, GetIDsFromNames, (ULONG, cNames), (LPMAPINAMEID *, ppNames), (ULONG, ulFlags), (LPSPropTagArray *, pptaga))