diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/body.cpp | 5 | ||||
| -rw-r--r-- | src/emptyContentHandler.cpp | 12 | ||||
| -rw-r--r-- | src/net/imap/IMAPMessagePartContentHandler.cpp | 15 | ||||
| -rw-r--r-- | src/streamContentHandler.cpp | 17 | ||||
| -rw-r--r-- | src/stringContentHandler.cpp | 18 |
5 files changed, 64 insertions, 3 deletions
diff --git a/src/body.cpp b/src/body.cpp index d68254c7..f1a8cc0f 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -494,7 +494,10 @@ void body::generateImpl else { // Generate the contents - m_contents->generate(os, getEncoding(), ctx.getMaxLineLength()); + ref <contentHandler> contents = m_contents->clone(); + contents->setContentTypeHint(getContentType()); + + contents->generate(os, getEncoding(), ctx.getMaxLineLength()); } } diff --git a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp index d672ae24..07b53391 100644 --- a/src/emptyContentHandler.cpp +++ b/src/emptyContentHandler.cpp @@ -102,4 +102,16 @@ bool emptyContentHandler::isBuffered() const } +void emptyContentHandler::setContentTypeHint(const mediaType& type) +{ + m_contentType = type; +} + + +const mediaType emptyContentHandler::getContentTypeHint() const +{ + return m_contentType; +} + + } // vmime diff --git a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp index 277ca579..c34dc076 100644 --- a/src/net/imap/IMAPMessagePartContentHandler.cpp +++ b/src/net/imap/IMAPMessagePartContentHandler.cpp @@ -90,6 +90,8 @@ void IMAPMessagePartContentHandler::generate ref <utility::encoder::encoder> theEncoder = enc.getEncoder(); theEncoder->getProperties()["maxlinelength"] = maxLineLength; + theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT); + theEncoder->encode(tempIn, os); } // No encoding to perform @@ -110,6 +112,7 @@ void IMAPMessagePartContentHandler::generate // Encode temporary buffer to output stream ref <utility::encoder::encoder> theEncoder = enc.getEncoder(); theEncoder->getProperties()["maxlinelength"] = maxLineLength; + theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT); utility::inputStreamStringAdapter is(oss.str()); @@ -188,6 +191,18 @@ bool IMAPMessagePartContentHandler::isBuffered() const } +void IMAPMessagePartContentHandler::setContentTypeHint(const mediaType& type) +{ + m_contentType = type; +} + + +const mediaType IMAPMessagePartContentHandler::getContentTypeHint() const +{ + return m_contentType; +} + + } // imap } // net } // vmime diff --git a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp index 711ac4dc..d6444833 100644 --- a/src/streamContentHandler.cpp +++ b/src/streamContentHandler.cpp @@ -52,7 +52,7 @@ streamContentHandler::~streamContentHandler() streamContentHandler::streamContentHandler(const streamContentHandler& cts) - : contentHandler(), m_encoding(cts.m_encoding), + : contentHandler(), m_encoding(cts.m_encoding), m_contentType(cts.m_contentType), m_stream(cts.m_stream), m_length(cts.m_length) { } @@ -66,6 +66,7 @@ ref <contentHandler> streamContentHandler::clone() const streamContentHandler& streamContentHandler::operator=(const streamContentHandler& cts) { + m_contentType = cts.m_contentType; m_encoding = cts.m_encoding; m_stream = cts.m_stream; @@ -103,6 +104,7 @@ void streamContentHandler::generate(utility::outputStream& os, const vmime::enco ref <utility::encoder::encoder> theEncoder = enc.getEncoder(); theEncoder->getProperties()["maxlinelength"] = maxLineLength; + theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT); m_stream->reset(); // may not work... @@ -129,6 +131,7 @@ void streamContentHandler::generate(utility::outputStream& os, const vmime::enco { ref <utility::encoder::encoder> theEncoder = enc.getEncoder(); theEncoder->getProperties()["maxlinelength"] = maxLineLength; + theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT); m_stream->reset(); // may not work... @@ -216,4 +219,16 @@ bool streamContentHandler::isBuffered() const } +void streamContentHandler::setContentTypeHint(const mediaType& type) +{ + m_contentType = type; +} + + +const mediaType streamContentHandler::getContentTypeHint() const +{ + return m_contentType; +} + + } // vmime diff --git a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp index 52bbd230..e4762dce 100644 --- a/src/stringContentHandler.cpp +++ b/src/stringContentHandler.cpp @@ -44,7 +44,8 @@ stringContentHandler::stringContentHandler(const string& buffer, const vmime::en stringContentHandler::stringContentHandler(const stringContentHandler& cts) - : contentHandler(), m_encoding(cts.m_encoding), m_string(cts.m_string) + : contentHandler(), m_contentType(cts.m_contentType), + m_encoding(cts.m_encoding), m_string(cts.m_string) { } @@ -75,6 +76,7 @@ ref <contentHandler> stringContentHandler::clone() const stringContentHandler& stringContentHandler::operator=(const stringContentHandler& cts) { + m_contentType = cts.m_contentType; m_encoding = cts.m_encoding; m_string = cts.m_string; @@ -127,6 +129,7 @@ void stringContentHandler::generate(utility::outputStream& os, ref <utility::encoder::encoder> theEncoder = enc.getEncoder(); theEncoder->getProperties()["maxlinelength"] = maxLineLength; + theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT); utility::inputStreamStringProxyAdapter in(m_string); @@ -151,6 +154,7 @@ void stringContentHandler::generate(utility::outputStream& os, { ref <utility::encoder::encoder> theEncoder = enc.getEncoder(); theEncoder->getProperties()["maxlinelength"] = maxLineLength; + theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT); utility::inputStreamStringProxyAdapter in(m_string); @@ -217,4 +221,16 @@ bool stringContentHandler::isBuffered() const } +void stringContentHandler::setContentTypeHint(const mediaType& type) +{ + m_contentType = type; +} + + +const mediaType stringContentHandler::getContentTypeHint() const +{ + return m_contentType; +} + + } // vmime |
