aboutsummaryrefslogtreecommitdiffstats
path: root/src/messageParser.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2006-08-21 13:20:30 +0000
committerVincent Richard <[email protected]>2006-08-21 13:20:30 +0000
commitbcaff413ca5014b2a7fe521e6bea42375a3e90e9 (patch)
treee3f75094633d3a44c3552ffb02bb44154dafaac0 /src/messageParser.cpp
parentOops... Removed IMAP response debug. (diff)
downloadvmime-bcaff413ca5014b2a7fe521e6bea42375a3e90e9.tar.gz
vmime-bcaff413ca5014b2a7fe521e6bea42375a3e90e9.zip
Do not treat attached text files as text parts.
Diffstat (limited to 'src/messageParser.cpp')
-rw-r--r--src/messageParser.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/messageParser.cpp b/src/messageParser.cpp
index 18809e82..293a71ee 100644
--- a/src/messageParser.cpp
+++ b/src/messageParser.cpp
@@ -30,6 +30,7 @@
#include "vmime/relay.hpp"
#include "vmime/contentTypeField.hpp"
+#include "vmime/contentDispositionField.hpp"
namespace vmime
@@ -174,10 +175,24 @@ bool messageParser::findSubTextParts(ref <const bodyPart> msg, ref <const bodyPa
(*(p->getHeader()->findField(fields::CONTENT_TYPE)));
const mediaType type = *ctf.getValue().dynamicCast <const mediaType>();
+ contentDisposition disp; // default should be inline
if (type.getType() == mediaTypes::TEXT)
{
- textParts.push_back(p);
+ try
+ {
+ ref <const contentDispositionField> cdf = p->getHeader()->
+ findField(fields::CONTENT_DISPOSITION).dynamicCast <const contentDispositionField>();
+
+ disp = *cdf->getValue().dynamicCast <const contentDisposition>();
+ }
+ catch (exceptions::no_such_field&)
+ {
+ // No "Content-Disposition" field, assume default
+ }
+
+ if (disp.getName() == contentDispositionTypes::INLINE)
+ textParts.push_back(p);
}
}
catch (exceptions::no_such_field&)