diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-24 15:16:04 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-25 10:24:22 +0200 |
commit | 41f1c5c6b1403306535f308d2656a3ba94fb9a5c (patch) | |
tree | 125ed924281e37422e4c01d79a2b633b9ecbd9ae /framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp | |
parent | 14e46bdc5647c03e667a88676916ef414adf69f3 (diff) | |
download | kube-41f1c5c6b1403306535f308d2656a3ba94fb9a5c.tar.gz kube-41f1c5c6b1403306535f308d2656a3ba94fb9a5c.zip |
Deal with rfc822 header parts
As inserted by autocrypt enabled clients.
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp')
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp b/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp index 532a906e..a6713fef 100644 --- a/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp +++ b/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp | |||
@@ -92,34 +92,48 @@ class MessageRfc822BodyPartFormatter | |||
92 | { | 92 | { |
93 | static const MessageRfc822BodyPartFormatter *self; | 93 | static const MessageRfc822BodyPartFormatter *self; |
94 | public: | 94 | public: |
95 | MessagePart::Ptr process(Interface::BodyPart &) const Q_DECL_OVERRIDE; | 95 | MessagePart::Ptr process(Interface::BodyPart &part) const Q_DECL_OVERRIDE |
96 | static const MimeTreeParser::Interface::BodyPartFormatter *create(); | 96 | { |
97 | return MessagePart::Ptr(new EncapsulatedRfc822MessagePart(part.objectTreeParser(), part.content(), part.content()->bodyAsMessage())); | ||
98 | } | ||
99 | |||
100 | static const MimeTreeParser::Interface::BodyPartFormatter *create() | ||
101 | { | ||
102 | if (!self) { | ||
103 | self = new MessageRfc822BodyPartFormatter(); | ||
104 | } | ||
105 | return self; | ||
106 | } | ||
97 | }; | 107 | }; |
98 | 108 | ||
99 | const MessageRfc822BodyPartFormatter *MessageRfc822BodyPartFormatter::self; | 109 | const MessageRfc822BodyPartFormatter *MessageRfc822BodyPartFormatter::self; |
100 | 110 | ||
101 | const MimeTreeParser::Interface::BodyPartFormatter *MessageRfc822BodyPartFormatter::create() | 111 | class HeadersBodyPartFormatter |
112 | : public MimeTreeParser::Interface::BodyPartFormatter | ||
102 | { | 113 | { |
103 | if (!self) { | 114 | static const HeadersBodyPartFormatter *self; |
104 | self = new MessageRfc822BodyPartFormatter(); | 115 | public: |
116 | MessagePart::Ptr process(Interface::BodyPart &part) const Q_DECL_OVERRIDE | ||
117 | { | ||
118 | return MessagePart::Ptr(new HeadersPart(part.objectTreeParser(), part.content())); | ||
105 | } | 119 | } |
106 | return self; | ||
107 | } | ||
108 | 120 | ||
109 | MessagePart::Ptr MessageRfc822BodyPartFormatter::process(Interface::BodyPart &part) const | 121 | static const MimeTreeParser::Interface::BodyPartFormatter *create() { |
110 | { | 122 | if (!self) { |
111 | const KMime::Message::Ptr message = part.content()->bodyAsMessage(); | 123 | self = new HeadersBodyPartFormatter(); |
112 | return MessagePart::Ptr(new EncapsulatedRfc822MessagePart(part.objectTreeParser(), part.content(), message)); | 124 | } |
113 | } | 125 | return self; |
126 | } | ||
127 | }; | ||
114 | 128 | ||
115 | typedef TextPlainBodyPartFormatter ApplicationPgpBodyPartFormatter; | 129 | const HeadersBodyPartFormatter *HeadersBodyPartFormatter::self = nullptr; |
116 | 130 | ||
117 | } // anon namespace | 131 | } // anon namespace |
118 | 132 | ||
119 | void BodyPartFormatterBaseFactoryPrivate::messageviewer_create_builtin_bodypart_formatters() | 133 | void BodyPartFormatterBaseFactoryPrivate::messageviewer_create_builtin_bodypart_formatters() |
120 | { | 134 | { |
121 | insert("application", "octet-stream", AnyTypeBodyPartFormatter::create()); | 135 | insert("application", "octet-stream", AnyTypeBodyPartFormatter::create()); |
122 | insert("application", "pgp", ApplicationPgpBodyPartFormatter::create()); | 136 | insert("application", "pgp", TextPlainBodyPartFormatter::create()); |
123 | insert("application", "pkcs7-mime", ApplicationPkcs7MimeBodyPartFormatter::create()); | 137 | insert("application", "pkcs7-mime", ApplicationPkcs7MimeBodyPartFormatter::create()); |
124 | insert("application", "x-pkcs7-mime", ApplicationPkcs7MimeBodyPartFormatter::create()); | 138 | insert("application", "x-pkcs7-mime", ApplicationPkcs7MimeBodyPartFormatter::create()); |
125 | insert("application", "pgp-encrypted", ApplicationPGPEncryptedBodyPartFormatter::create()); | 139 | insert("application", "pgp-encrypted", ApplicationPGPEncryptedBodyPartFormatter::create()); |
@@ -129,6 +143,7 @@ void BodyPartFormatterBaseFactoryPrivate::messageviewer_create_builtin_bodypart_ | |||
129 | insert("text", "rtf", AnyTypeBodyPartFormatter::create()); | 143 | insert("text", "rtf", AnyTypeBodyPartFormatter::create()); |
130 | insert("text", "plain", MailmanBodyPartFormatter::create()); | 144 | insert("text", "plain", MailmanBodyPartFormatter::create()); |
131 | insert("text", "plain", TextPlainBodyPartFormatter::create()); | 145 | insert("text", "plain", TextPlainBodyPartFormatter::create()); |
146 | insert("text", "rfc822-headers", HeadersBodyPartFormatter::create()); | ||
132 | insert("text", "*", MailmanBodyPartFormatter::create()); | 147 | insert("text", "*", MailmanBodyPartFormatter::create()); |
133 | insert("text", "*", TextPlainBodyPartFormatter::create()); | 148 | insert("text", "*", TextPlainBodyPartFormatter::create()); |
134 | 149 | ||