From bcaff413ca5014b2a7fe521e6bea42375a3e90e9 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 21 Aug 2006 13:20:30 +0000 Subject: [PATCH] Do not treat attached text files as text parts. --- src/messageParser.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 msg, ref getHeader()->findField(fields::CONTENT_TYPE))); const mediaType type = *ctf.getValue().dynamicCast (); + contentDisposition disp; // default should be inline if (type.getType() == mediaTypes::TEXT) { - textParts.push_back(p); + try + { + ref cdf = p->getHeader()-> + findField(fields::CONTENT_DISPOSITION).dynamicCast (); + + disp = *cdf->getValue().dynamicCast (); + } + 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&)