ProtocolBase.h 2.3 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 PROTOCOLBASE_H
  18. #define PROTOCOLBASE_H
  19. #include <kopano/memory.hpp>
  20. #include <mapi.h>
  21. #include "Http.h"
  22. class ProtocolBase {
  23. public:
  24. ProtocolBase(Http *, IMAPISession *, const std::string &srv_tz, const std::string &charset);
  25. virtual ~ProtocolBase();
  26. HRESULT HrInitializeClass();
  27. virtual HRESULT HrHandleCommand(const std::string &strMethod) = 0;
  28. protected:
  29. Http *m_lpRequest = nullptr;
  30. IMAPISession *m_lpSession = nullptr;
  31. std::string m_strSrvTz;
  32. std::string m_strCharset;
  33. IMsgStore *m_lpDefStore = nullptr; //!< We always need the store of the user that is logged in.
  34. IMsgStore *m_lpActiveStore = nullptr; //!< The store we're acting on
  35. IAddrBook *m_lpAddrBook = nullptr;
  36. IMailUser *m_lpLoginUser = nullptr; //!< the logged in user
  37. IMailUser *m_lpActiveUser = nullptr; //!< the owner of m_lpActiveStore
  38. IMAPIFolder *m_lpUsrFld = nullptr; //!< The active folder (calendar, inbox, outbox)
  39. IMAPIFolder *m_lpIPMSubtree = nullptr; //!< IPMSubtree of active store, used for CopyFolder/CreateFolder
  40. KCHL::memory_ptr<SPropTagArray> m_lpNamedProps; //!< named properties of the active store
  41. std::wstring m_wstrFldOwner; //!< url owner part
  42. std::wstring m_wstrFldName; //!< url foldername part
  43. std::wstring m_wstrUser; //!< login username (http auth user)
  44. bool m_blFolderAccess = true; //!< can we delete the current folder
  45. ULONG m_ulUrlFlag = 0;
  46. ULONG m_ulFolderFlag = 0;
  47. convert_context m_converter;
  48. std::string W2U(const std::wstring&); //!< convert widestring to UTF-8
  49. std::string W2U(const WCHAR* lpwWideChar);
  50. std::wstring U2W(const std::string&); //!< convert UTF-8 to widestring
  51. std::string SPropValToString(const SPropValue *lpSprop);
  52. std::string strAgent;
  53. };
  54. #endif