ECMailUser.cpp 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #include <new>
  17. #include <kopano/platform.h>
  18. #include <kopano/ECInterfaceDefs.h>
  19. #include "resource.h"
  20. #include <mapiutil.h>
  21. #include "kcore.hpp"
  22. #include <kopano/CommonUtil.h>
  23. #include "ECMailUser.h"
  24. #include "Mem.h"
  25. #include <kopano/ECGuid.h>
  26. #include <kopano/ECDebug.h>
  27. ECMailUser::ECMailUser(void* lpProvider, BOOL fModify) : ECABProp(lpProvider, MAPI_MAILUSER, fModify, "IMailUser")
  28. {
  29. // since we have no OpenProperty / abLoadProp, remove the 8k prop limit
  30. this->m_ulMaxPropSize = 0;
  31. }
  32. HRESULT ECMailUser::Create(void* lpProvider, BOOL fModify, ECMailUser** lppMailUser)
  33. {
  34. return alloc_wrap<ECMailUser>(lpProvider, fModify)
  35. .as(IID_ECMailUser, lppMailUser);
  36. }
  37. HRESULT ECMailUser::QueryInterface(REFIID refiid, void **lppInterface)
  38. {
  39. REGISTER_INTERFACE2(ECMailUser, this);
  40. REGISTER_INTERFACE2(ECABProp, this);
  41. REGISTER_INTERFACE2(ECUnknown, this);
  42. REGISTER_INTERFACE2(IMailUser, &this->m_xMailUser);
  43. REGISTER_INTERFACE2(IMAPIProp, &this->m_xMailUser);
  44. REGISTER_INTERFACE2(IUnknown, &this->m_xMailUser);
  45. return MAPI_E_INTERFACE_NOT_SUPPORTED;
  46. }
  47. HRESULT ECMailUser::TableRowGetProp(void* lpProvider, struct propVal *lpsPropValSrc, LPSPropValue lpsPropValDst, void **lpBase, ULONG ulType)
  48. {
  49. return MAPI_E_NOT_FOUND;
  50. }
  51. HRESULT ECMailUser::OpenProperty(ULONG ulPropTag, LPCIID lpiid, ULONG ulInterfaceOptions, ULONG ulFlags, LPUNKNOWN *lppUnk)
  52. {
  53. if (lpiid == NULL)
  54. return MAPI_E_INVALID_PARAMETER;
  55. if (ulFlags & MAPI_CREATE)
  56. // Don't support creating any sub-objects
  57. return MAPI_E_NO_ACCESS;
  58. return ECABProp::OpenProperty(ulPropTag, lpiid, ulInterfaceOptions, ulFlags, lppUnk);
  59. }
  60. HRESULT ECMailUser::CopyTo(ULONG ciidExclude, LPCIID rgiidExclude,
  61. const SPropTagArray *lpExcludeProps, ULONG ulUIParam,
  62. LPMAPIPROGRESS lpProgress, LPCIID lpInterface, void *lpDestObj,
  63. ULONG ulFlags, SPropProblemArray **lppProblems)
  64. {
  65. return this->GetABStore()->m_lpMAPISup->DoCopyTo(&IID_IMailUser, &this->m_xMailUser, ciidExclude, rgiidExclude, lpExcludeProps, ulUIParam, lpProgress, lpInterface, lpDestObj, ulFlags, lppProblems);
  66. }
  67. HRESULT ECMailUser::CopyProps(const SPropTagArray *lpIncludeProps,
  68. ULONG ulUIParam, LPMAPIPROGRESS lpProgress, LPCIID lpInterface,
  69. void *lpDestObj, ULONG ulFlags, SPropProblemArray **lppProblems)
  70. {
  71. return this->GetABStore()->m_lpMAPISup->DoCopyProps(&IID_IMailUser, &this->m_xMailUser, lpIncludeProps, ulUIParam, lpProgress, lpInterface, lpDestObj, ulFlags, lppProblems);
  72. }
  73. // IMailUser
  74. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, QueryInterface, (REFIID, refiid), (void **, lppInterface))
  75. DEF_ULONGMETHOD1(TRACE_MAPI, ECMailUser, MailUser, AddRef, (void))
  76. DEF_ULONGMETHOD1(TRACE_MAPI, ECMailUser, MailUser, Release, (void))
  77. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, GetLastError, (HRESULT, hError), (ULONG, ulFlags), (LPMAPIERROR *, lppMapiError))
  78. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, SaveChanges, (ULONG, ulFlags))
  79. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, GetProps, (const SPropTagArray *, lpPropTagArray), (ULONG, ulFlags), (ULONG *, lpcValues), (SPropValue **, lppPropArray))
  80. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, GetPropList, (ULONG, ulFlags), (LPSPropTagArray *, lppPropTagArray))
  81. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, OpenProperty, (ULONG, ulPropTag), (LPCIID, lpiid), (ULONG, ulInterfaceOptions), (ULONG, ulFlags), (LPUNKNOWN *, lppUnk))
  82. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, SetProps, (ULONG, cValues), (const SPropValue *, lpPropArray), (SPropProblemArray **, lppProblems))
  83. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, DeleteProps, (const SPropTagArray *, lpPropTagArray), (SPropProblemArray **, lppProblems))
  84. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, CopyTo, (ULONG, ciidExclude), (LPCIID, rgiidExclude), (const SPropTagArray *, lpExcludeProps), (ULONG, ulUIParam), (LPMAPIPROGRESS, lpProgress), (LPCIID, lpInterface), (void *, lpDestObj), (ULONG, ulFlags), (SPropProblemArray **, lppProblems))
  85. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, CopyProps, (const SPropTagArray *, lpIncludeProps), (ULONG, ulUIParam), (LPMAPIPROGRESS, lpProgress), (LPCIID, lpInterface), (void *, lpDestObj), (ULONG, ulFlags), (SPropProblemArray **, lppProblems))
  86. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, GetNamesFromIDs, (LPSPropTagArray *, pptaga), (LPGUID, lpguid), (ULONG, ulFlags), (ULONG *, pcNames), (LPMAPINAMEID **, pppNames))
  87. DEF_HRMETHOD1(TRACE_MAPI, ECMailUser, MailUser, GetIDsFromNames, (ULONG, cNames), (LPMAPINAMEID *, ppNames), (ULONG, ulFlags), (LPSPropTagArray *, pptaga))