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&)