archive.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 __DAGENT_ARCHIVE_H
  18. #define __DAGENT_ARCHIVE_H
  19. #include <kopano/zcdefs.h>
  20. #include <mapidefs.h>
  21. #include <mapix.h>
  22. #include <kopano/mapi_ptr.h>
  23. #include <list>
  24. #include <memory>
  25. class ArchiveResult _kc_final {
  26. public:
  27. void AddMessage(MessagePtr ptrMessage);
  28. void Undo(IMAPISession *lpSession);
  29. private:
  30. std::list<MessagePtr> m_lstMessages;
  31. };
  32. class Archive;
  33. typedef std::unique_ptr<Archive> ArchivePtr;
  34. class Archive _kc_final {
  35. public:
  36. static HRESULT Create(IMAPISession *, ArchivePtr *);
  37. HRESULT HrArchiveMessageForDelivery(IMessage *lpMessage);
  38. HRESULT HrArchiveMessageForSending(IMessage *lpMessage, ArchiveResult *lpResult);
  39. bool HaveErrorMessage() const { return !m_strErrorMessage.empty(); }
  40. LPCTSTR GetErrorMessage() const { return m_strErrorMessage.c_str(); }
  41. private:
  42. Archive(IMAPISession *);
  43. void SetErrorMessage(HRESULT hr, LPCTSTR lpszMessage);
  44. // Inhibit copying
  45. Archive(const Archive &) = delete;
  46. Archive &operator=(const Archive &) = delete;
  47. MAPISessionPtr m_ptrSession;
  48. tstring m_strErrorMessage;
  49. };
  50. #endif // ndef __DAGENT_ARCHIVE_H