diff options
author | Sandro Knauß <sknauss@kde.org> | 2016-11-08 16:23:19 +0100 |
---|---|---|
committer | Sandro Knauß <sknauss@kde.org> | 2016-11-08 16:23:47 +0100 |
commit | e8fb7de6fc6a9c5e56fd827e65745a0781761b3d (patch) | |
tree | 4c17d36dd6c0c6011ccce1d2467d44f6ab4103f1 | |
parent | 026278f1cf0c692b8ba134c84c26da5bb8274d67 (diff) | |
download | kube-e8fb7de6fc6a9c5e56fd827e65745a0781761b3d.tar.gz kube-e8fb7de6fc6a9c5e56fd827e65745a0781761b3d.zip |
better desciion between attachment/content
-rw-r--r-- | framework/domain/mimetreeparser/interface.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/framework/domain/mimetreeparser/interface.cpp b/framework/domain/mimetreeparser/interface.cpp index 7e9497c0..181aa0a9 100644 --- a/framework/domain/mimetreeparser/interface.cpp +++ b/framework/domain/mimetreeparser/interface.cpp | |||
@@ -976,18 +976,23 @@ QVector<Part::Ptr> Parser::collectContentParts() const | |||
976 | } | 976 | } |
977 | } | 977 | } |
978 | } | 978 | } |
979 | |||
980 | const auto ctname = mime->mimetype().name().trimmed().toLower(); | ||
981 | bool mightContent = false; | ||
982 | |||
983 | if (ctname.startsWith("text/") || ctname.startsWith("image/") || ctname.isEmpty()) { | ||
984 | mightContent = true; | ||
985 | } | ||
986 | |||
979 | const auto cd = mime->disposition(); | 987 | const auto cd = mime->disposition(); |
980 | if (cd && cd == MailMime::Inline) { | 988 | if (cd && cd == MailMime::Inline) { |
981 | // explict "inline" disposition: | 989 | return mightContent; |
982 | return true; | ||
983 | } | 990 | } |
984 | if (cd && cd == MailMime::Attachment) { | 991 | if (cd && cd == MailMime::Attachment) { |
985 | // explicit "attachment" disposition: | ||
986 | return false; | 992 | return false; |
987 | } | 993 | } |
988 | 994 | ||
989 | const auto ct = mime->mimetype(); | 995 | if ((ctname.startsWith("text/") || ctname.isEmpty()) && |
990 | if (ct.name().trimmed().toLower() == "text" && ct.name().trimmed().isEmpty() && | ||
991 | (!mime || mime->filename().trimmed().isEmpty())) { | 996 | (!mime || mime->filename().trimmed().isEmpty())) { |
992 | // text/* w/o filename parameter: | 997 | // text/* w/o filename parameter: |
993 | return true; | 998 | return true; |
@@ -1032,10 +1037,18 @@ QVector<Part::Ptr> Parser::collectAttachmentParts() const | |||
1032 | } | 1037 | } |
1033 | } | 1038 | } |
1034 | } | 1039 | } |
1040 | |||
1041 | const auto ctname = mime->mimetype().name().trimmed().toLower(); | ||
1042 | bool mightContent = false; | ||
1043 | |||
1044 | if (ctname.startsWith("text/") || ctname.startsWith("image/") || ctname.isEmpty()) { | ||
1045 | mightContent = true; | ||
1046 | } | ||
1047 | |||
1035 | const auto cd = mime->disposition(); | 1048 | const auto cd = mime->disposition(); |
1036 | if (cd && cd == MailMime::Inline) { | 1049 | if (cd && cd == MailMime::Inline) { |
1037 | // explict "inline" disposition: | 1050 | // explict "inline" disposition: |
1038 | return false; | 1051 | return !mightContent; |
1039 | } | 1052 | } |
1040 | if (cd && cd == MailMime::Attachment) { | 1053 | if (cd && cd == MailMime::Attachment) { |
1041 | // explicit "attachment" disposition: | 1054 | // explicit "attachment" disposition: |
@@ -1043,7 +1056,7 @@ QVector<Part::Ptr> Parser::collectAttachmentParts() const | |||
1043 | } | 1056 | } |
1044 | 1057 | ||
1045 | const auto ct = mime->mimetype(); | 1058 | const auto ct = mime->mimetype(); |
1046 | if (ct.name().trimmed().toLower() == "text" && ct.name().trimmed().isEmpty() && | 1059 | if ((ctname.startsWith("text/") || ctname.isEmpty()) && |
1047 | (!mime || mime->filename().trimmed().isEmpty())) { | 1060 | (!mime || mime->filename().trimmed().isEmpty())) { |
1048 | // text/* w/o filename parameter: | 1061 | // text/* w/o filename parameter: |
1049 | return false; | 1062 | return false; |