diff --git a/src/vmime/generationContext.cpp b/src/vmime/generationContext.cpp index 1d6313e7..4b637432 100644 --- a/src/vmime/generationContext.cpp +++ b/src/vmime/generationContext.cpp @@ -33,6 +33,7 @@ generationContext::generationContext() m_prologText("This is a multi-part message in MIME format. Your mail reader " \ "does not understand MIME message format."), m_epilogText(""), + m_wrapMessageId(true), m_paramValueMode(PARAMETER_VALUE_RFC2231_ONLY) { } @@ -43,6 +44,7 @@ generationContext::generationContext(const generationContext& ctx) m_maxLineLength(ctx.m_maxLineLength), m_prologText(ctx.m_prologText), m_epilogText(ctx.m_epilogText), + m_wrapMessageId(ctx.m_wrapMessageId), m_paramValueMode(ctx.m_paramValueMode) { } @@ -67,6 +69,7 @@ void generationContext::setMaxLineLength(const size_t maxLineLength) } + const string generationContext::getPrologText() const { return m_prologText; @@ -90,6 +93,15 @@ void generationContext::setEpilogText(const string& epilogText) m_epilogText = epilogText; } +bool generationContext::getWrapMessageId() const +{ + return m_wrapMessageId; +} + +void generationContext::setWrapMessageId(const bool& wrapMessageId) +{ + m_wrapMessageId = wrapMessageId; +} void generationContext::setEncodedParameterValueMode(const EncodedParameterValueModes mode) { diff --git a/src/vmime/generationContext.hpp b/src/vmime/generationContext.hpp index 22700c90..1cb4ce67 100644 --- a/src/vmime/generationContext.hpp +++ b/src/vmime/generationContext.hpp @@ -82,6 +82,25 @@ public: */ void setEpilogText(const string& epilogText); + /** Returns a boolean variable that indicates whether the + * message id can be wrapped or not, i.e. from + * + * Message-Id: + * + * to + * + * Message-Id: + * + * + * @return boolean indicating if the Message-Id can be wrapped + */ + bool getWrapMessageId() const; + + /** Sets the boolean variable that indicates whether the + * Message-Id can be wrapped or not + */ + void setWrapMessageId(const bool& wrapMessageId); + /** Modes available for generating values in parameterized header fields. */ enum EncodedParameterValueModes @@ -142,6 +161,7 @@ protected: string m_prologText; string m_epilogText; + bool m_wrapMessageId; EncodedParameterValueModes m_paramValueMode; }; diff --git a/src/vmime/messageId.cpp b/src/vmime/messageId.cpp index edc4d1fb..18926b4b 100644 --- a/src/vmime/messageId.cpp +++ b/src/vmime/messageId.cpp @@ -193,7 +193,7 @@ void messageId::generateImpl { size_t pos = curLinePos; - if (curLinePos + m_left.length() + m_right.length() + 3 > ctx.getMaxLineLength()) + if (ctx.getWrapMessageId() && (curLinePos + m_left.length() + m_right.length() + 3 > ctx.getMaxLineLength())) { os << NEW_LINE_SEQUENCE; pos = NEW_LINE_SEQUENCE_LENGTH;