SMIMEMessage.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 SMIMEMESSAGE_H
  18. #define SMIMEMESSAGE_H
  19. #include <kopano/zcdefs.h>
  20. #include <string>
  21. #include <vmime/message.hpp>
  22. #include <vmime/utility/stream.hpp>
  23. #include <vmime/generationContext.hpp>
  24. namespace KC {
  25. /**
  26. * We are adding a bit of functionality to vmime::message here for S/MIME support.
  27. *
  28. * MAPI provides us with the actual body of a signed S/MIME message that looks like
  29. *
  30. * -----------------------
  31. * Content-Type: xxxx
  32. *
  33. * data
  34. * data
  35. * data
  36. * ...
  37. * -----------------------
  38. *
  39. * This class works just like a vmime::message instance, except that when then 'SMIMEBody' is set, it will
  40. * use that body (including some headers!) to generate the RFC 2822 message. All other methods are inherited
  41. * directly from vmime::message.
  42. *
  43. * Note that any other body data set will be override by the SMIMEBody.
  44. *
  45. */
  46. class SMIMEMessage _kc_final : public vmime::message {
  47. public:
  48. void generateImpl(const vmime::generationContext &, vmime::utility::outputStream &, size_t curLinePos = 0, size_t *newLinePos = NULL) const;
  49. void setSMIMEBody(const char *body) { m_body = body; }
  50. private:
  51. std::string m_body;
  52. };
  53. } /* namespace */
  54. #endif