ArchiverSession.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 ARCHIVERSESSION_H_INCLUDED
  18. #define ARCHIVERSESSION_H_INCLUDED
  19. #include <kopano/zcdefs.h>
  20. #include "ArchiverSessionPtr.h"
  21. #include <kopano/mapi_ptr.h>
  22. #include <kopano/archiver-common.h>
  23. namespace KC {
  24. class ECConfig;
  25. class ECLogger;
  26. /**
  27. * The ArchiverSession class wraps the MAPISession and provides commonly used operations. It also
  28. * checks the license. This way the license doesn't need to be checked all over the place.
  29. */
  30. class _kc_export ArchiverSession _kc_final {
  31. public:
  32. static HRESULT Create(ECConfig *lpConfig, ECLogger *lpLogger, ArchiverSessionPtr *lpptrSession);
  33. static HRESULT Create(const MAPISessionPtr &ptrSession, ECLogger *lpLogger, ArchiverSessionPtr *lpptrSession);
  34. _kc_hidden static HRESULT Create(const MAPISessionPtr &, ECConfig *, ECLogger *, ArchiverSessionPtr *);
  35. _kc_hidden ~ArchiverSession(void);
  36. HRESULT OpenStoreByName(const tstring &strUser, LPMDB *lppMsgStore);
  37. _kc_hidden HRESULT OpenStore(const entryid_t &eid, ULONG flags, LPMDB *ret);
  38. HRESULT OpenStore(const entryid_t &eid, LPMDB *ret);
  39. _kc_hidden HRESULT OpenReadOnlyStore(const entryid_t &eid, LPMDB *ret);
  40. _kc_hidden HRESULT GetUserInfo(const tstring &user, abentryid_t *eid, tstring *fullname, bool *acl_capable);
  41. _kc_hidden HRESULT GetUserInfo(const abentryid_t &eid, tstring *user, tstring *fullname);
  42. _kc_hidden HRESULT GetGAL(LPABCONT *container);
  43. _kc_hidden HRESULT CompareStoreIds(LPMDB user_store, LPMDB arc_store, bool *res);
  44. _kc_hidden HRESULT CompareStoreIds(const entryid_t &, const entryid_t &, bool *res);
  45. _kc_hidden HRESULT CreateRemote(const char *server_path, ECLogger *, ArchiverSessionPtr *);
  46. _kc_hidden HRESULT OpenMAPIProp(ULONG eid_size, LPENTRYID eid, LPMAPIPROP *prop);
  47. _kc_hidden HRESULT OpenOrCreateArchiveStore(const tstring &user, const tstring &server, LPMDB *arc_store);
  48. _kc_hidden HRESULT GetArchiveStoreEntryId(const tstring &user, const tstring &server, entryid_t *arc_id);
  49. _kc_hidden IMAPISession *GetMAPISession(void) const { return m_ptrSession; }
  50. const char *GetSSLPath() const;
  51. const char *GetSSLPass() const;
  52. private:
  53. _kc_hidden ArchiverSession(ECLogger *);
  54. _kc_hidden HRESULT Init(ECConfig *);
  55. _kc_hidden HRESULT Init(const char *server_path, const char *ssl_path, const char *ssl_pass);
  56. _kc_hidden HRESULT Init(const MAPISessionPtr &, const char *ssl_path, const char *ssl_pass);
  57. _kc_hidden HRESULT CreateArchiveStore(const tstring &user, const tstring &server, LPMDB *arc_store);
  58. MAPISessionPtr m_ptrSession;
  59. MsgStorePtr m_ptrAdminStore;
  60. ECLogger *m_lpLogger;
  61. std::string m_strSslPath;
  62. std::string m_strSslPass;
  63. };
  64. } /* namespace */
  65. #endif // !defined ARCHIVERSESSION_H_INCLUDED