CalDavUtil.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 CALDAV_UTIL_H_
  18. #define CALDAV_UTIL_H_
  19. #include "WebDav.h"
  20. #include <kopano/mapiext.h>
  21. #include <kopano/mapiguidext.h>
  22. #include <cstring>
  23. #include <algorithm>
  24. #include <kopano/namedprops.h>
  25. #include "nameids.h"
  26. #include "icaluid.h"
  27. #include <edkguid.h>
  28. #include "freebusy.h"
  29. #include "ECFreeBusySupport.h"
  30. #include "MAPIToICal.h"
  31. #define FOLDER_PREFIX L"FLDPRFX_"
  32. // folder type according to URL
  33. #define SINGLE_FOLDER 0x01
  34. #define DEFAULT_FOLDER 0x02
  35. #define SHARED_FOLDER 0x04
  36. // folder type according to content
  37. #define OTHER_FOLDER 0x01
  38. #define CALENDAR_FOLDER 0x02
  39. #define TASKS_FOLDER 0x03
  40. //Performs login to the Kopano server and returns Session.
  41. extern HRESULT HrAuthenticate(const std::string &app_vers, const std::string &app_misc, const std::wstring &user, const std::wstring &pass, const std::string &path, IMAPISession **);
  42. //Adds property FolderID to the folder if not present else returns it.
  43. HRESULT HrAddProperty(IMsgStore *lpMsgStore, SBinary sbEid, ULONG ulPropertyId, bool bIsFldID, std::wstring *wstrProperty);
  44. //Adds property FolderID && dispidApptTsRef to the folder & message respectively, if not present else returns it.
  45. HRESULT HrAddProperty(IMAPIProp *lpMapiProp, ULONG ulPropertyId, bool bIsFldID, std::wstring *wstrProperty);
  46. //Finds folder from hierarchy table refering to the Folder ID, entryid or folder name
  47. extern HRESULT HrFindFolder(IMsgStore *, IMAPIFolder *root, SPropTagArray *lpNamedProps, const std::wstring &wstrFldId, IMAPIFolder **ufld);
  48. //Adds data to structure for acl request.
  49. HRESULT HrBuildACL(WEBDAVPROPERTY *lpsProperty);
  50. // Generate supported report set.
  51. HRESULT HrBuildReportSet(WEBDAVPROPERTY *lpsProperty);
  52. //Retrieve the User's Email address.
  53. HRESULT HrGetOwner(IMAPISession *lpSession, IMsgStore *lpDefStore, IMailUser **lppMailUser);
  54. //Strip the input to get Guid Value
  55. //eg input: caldav/Calendar/ai-43873034lakljk403-3245.ics
  56. //return: ai-43873034lakljk403-3245
  57. std::string StripGuid(const std::string &strInput);
  58. //Returns Calendars of Folder and sorted by PR_ENTRY_ID.
  59. HRESULT HrGetSubCalendars(IMAPISession *lpSession, IMAPIFolder *lpFolderIn, SBinary *lpsbEid, IMAPITable **lppTable);
  60. // Checks for private message.
  61. bool IsPrivate(LPMESSAGE lpMessage, ULONG ulPropIDPrivate);
  62. bool HasDelegatePerm(IMsgStore *lpDefStore, IMsgStore *lpSharedStore);
  63. HRESULT HrMakeRestriction(const std::string &strGuid, LPSPropTagArray lpNamedProps, LPSRestriction *lpsRectrict);
  64. HRESULT HrFindAndGetMessage(std::string strGuid, IMAPIFolder *lpUsrFld, LPSPropTagArray lpNamedProps, IMessage **lppMessage);
  65. HRESULT HrGetFreebusy(MapiToICal *lpMapiToIcal, IFreeBusySupport* lpFBSupport, IAddrBook *lpAddrBook, std::list<std::string> *lplstUsers, WEBDAVFBINFO *lpFbInfo);
  66. #endif