ClientUtil.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 CLIENTUTIL_H
  18. #define CLIENTUTIL_H
  19. #include <mapispi.h>
  20. #include <string>
  21. #include <kopano/ECTags.h>
  22. #include <edkmdb.h>
  23. #include <kopano/zcdefs.h>
  24. class WSTransport;
  25. struct sGlobalProfileProps {
  26. std::string strServerPath;
  27. std::string strProfileName;
  28. std::wstring strUserName;
  29. std::wstring strPassword;
  30. std::wstring strImpersonateUser;
  31. ULONG ulProfileFlags;
  32. std::string strSSLKeyFile;
  33. std::string strSSLKeyPass;
  34. ULONG ulConnectionTimeOut;
  35. ULONG ulProxyFlags;
  36. std::string strProxyHost;
  37. ULONG ulProxyPort;
  38. std::string strProxyUserName;
  39. std::string strProxyPassword;
  40. tstring strOfflinePath;
  41. bool bIsEMS;
  42. std::string strClientAppVersion;
  43. std::string strClientAppMisc;
  44. };
  45. class ClientUtil _kc_final {
  46. public:
  47. static HRESULT HrInitializeStatusRow (const char * lpszProviderDisplay, ULONG ulResourceType, LPMAPISUP lpMAPISup, LPSPropValue lpspvIdentity, ULONG ulFlags);
  48. static HRESULT HrSetIdentity(WSTransport *lpTransport, LPMAPISUP lpMAPISup, LPSPropValue* lppIdentityProps);
  49. static HRESULT ReadReceipt(ULONG ulFlags, LPMESSAGE lpReadMessage, LPMESSAGE* lppEmptyMessage);
  50. // Get the global properties
  51. static HRESULT GetGlobalProfileProperties(LPPROFSECT lpGlobalProfSect, struct sGlobalProfileProps* lpsProfileProps);
  52. static HRESULT GetGlobalProfileProperties(LPMAPISUP lpMAPISup, struct sGlobalProfileProps* lpsProfileProps);
  53. // Get the deligate stores from the global profile
  54. static HRESULT GetGlobalProfileDelegateStoresProp(LPPROFSECT lpGlobalProfSect, ULONG *lpcDelegates, LPBYTE *lppDelegateStores);
  55. // Get MSEMS emulator config
  56. static HRESULT GetConfigPath(std::string *lpConfigPath);
  57. // Convert MSEMS profile properties into ZARAFA profile properties
  58. static HRESULT ConvertMSEMSProps(ULONG cValues, LPSPropValue pValues, ULONG *lpcValues, LPSPropValue *lppProps);
  59. };
  60. HRESULT HrCreateEntryId(GUID guidStore, unsigned int ulObjType, ULONG* lpcbEntryId, LPENTRYID* lppEntryId);
  61. HRESULT HrGetServerURLFromStoreEntryId(ULONG cbEntryId, LPENTRYID lpEntryId, std::string& rServerPath, bool *lpbIsPseudoUrl);
  62. HRESULT HrResolvePseudoUrl(WSTransport *lpTransport, const char *lpszUrl, std::string& serverPath, bool *lpbIsPeer);
  63. HRESULT HrCompareEntryIdWithStoreGuid(ULONG cbEntryID, LPENTRYID lpEntryID, LPCGUID guidStore);
  64. enum enumPublicEntryID { ePE_None, ePE_IPMSubtree, ePE_Favorites, ePE_PublicFolders, ePE_FavoriteSubFolder };
  65. HRESULT GetPublicEntryId(enumPublicEntryID ePublicEntryID, GUID guidStore, void *lpBase, ULONG *lpcbEntryID, LPENTRYID *lppEntryID);
  66. BOOL CompareMDBProvider(LPBYTE lpguid, const GUID *lpguidKopano);
  67. BOOL CompareMDBProvider(MAPIUID* lpguid, const GUID *lpguidKopano);
  68. #endif