diff --git a/mimetreeparser/autotests/data/hidden/openpgp-inline-encrypted-with-attachment.mbox.html b/mimetreeparser/autotests/data/hidden/openpgp-inline-encrypted-with-attachment.mbox.html
new file mode 100644
--- /dev/null
+++ b/mimetreeparser/autotests/data/hidden/openpgp-inline-encrypted-with-attachment.mbox.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+ |
+
+
+ End of signed message |
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
diff --git a/mimetreeparser/autotests/data/iconic/openpgp-inline-encrypted-with-attachment.mbox.html b/mimetreeparser/autotests/data/iconic/openpgp-inline-encrypted-with-attachment.mbox.html
new file mode 100644
--- /dev/null
+++ b/mimetreeparser/autotests/data/iconic/openpgp-inline-encrypted-with-attachment.mbox.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+ |
+
+
+ End of signed message |
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
diff --git a/mimetreeparser/autotests/data/inlined/openpgp-inline-encrypted-with-attachment.mbox.html b/mimetreeparser/autotests/data/inlined/openpgp-inline-encrypted-with-attachment.mbox.html
new file mode 100644
--- /dev/null
+++ b/mimetreeparser/autotests/data/inlined/openpgp-inline-encrypted-with-attachment.mbox.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+ |
+
+
+ End of signed message |
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
diff --git a/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox b/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox
new file mode 100644
--- /dev/null
+++ b/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox
@@ -0,0 +1,57 @@
+From you@you.com Mon Oct 30 10:00:46 2017
+From: YOU
+To: test@kolab.org
+Reply-To: you@you.com
+Subject: inline test with attachment
+Date: Mon, 30 Oct 2017 10:00:46 +0000
+Message-ID: <4843823.hcbsSplVWp@baedc5b0dfed>
+X-KMail-Identity: 989793700
+X-KMail-Transport: -1
+X-KMail-Fcc: 6
+X-KMail-Dictionary: en_US
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="nextPart2479832.kuY37TRtyA"
+Content-Transfer-Encoding: 7Bit
+
+This is a multi-part message in MIME format.
+
+--nextPart2479832.kuY37TRtyA
+Content-Transfer-Encoding: 7Bit
+Content-Type: text/plain; charset="us-ascii"
+
+-----BEGIN PGP MESSAGE-----
+Version: GnuPG v2
+
+hQEMAwzOQ1qnzNo7AQf/fx2+ysb3BJ34Ag5CJI4phka7Tq1StwKwAjmBy76evLlZ
+8nf0YYiLKz5aeqse/FnwKqd2LZFSI58Od5P4QwsNIpO0NMt0ThBv3wupRtOs2FFk
+AQhCrvMog9K+OblKyQ2xKpLLFwv5iNKY2g3zMxZQgYu5spPquPh97RlRl24RZ1qQ
+Tg3uz6BvgPGY3jZ7PumpjsqpDcIBr3WaAVzby3VFJ/o+c8uRW94GyGfIjBps5xfU
+sBPDsasRtpQYDl/pgiU7MK4mmy/YZwQzuJlgr4wmfzf4qVF+JTHQgkHm/hx/1DZ2
+ikFwkaUSzhAhbC6mtVSO4eFRzkUaIwyYLYb+/I1/e9LAwwH0ibtRV/veyuOdXwMs
+4KwXjZhazuXmYz3u7c9HJ9NW17wiiRzueveOOHo1JM5M9pLBiw+7O8Yo7nM03kEE
+vM2zitQ2iSt5TBUV9UjFC5OX+LYPx8A4IxuKewjJyTYBf/SrB8ProkOw7gpBQXuV
+FRrpVSWZk1FZAPr306si4yc89+TGFjkhi8mP2OjICuJ1bm9msPIRmYtGBDtV7AZ9
+Wuem2cwn9gkGwNiN/UJIjqy8YQoWcC7UuSM9oPRw/gZThI5Y5Seqo/2tIatgFENx
+tz0VfRFUpex1j40MEzolMSGtsb2MXdavhXCcYC/Dh7Qgophn3g2gDpzYJnhPqaph
+BY9PbjIgiuBTyLNer/LMHzvCaR+yW/+PLoTLOmygjNWQuMFGFRcJJVxhbXAgbM5Q
+HKn9G83DuMB85gMLhVfH3cS+0zTxnTmTQUk1tXkWx7UjdLEChva5emBjyP+cAmYR
+6JsUrSFhN0inqn8wEXNTjA1syINGFY3pmCoqfdaP8wFMwtqzXQ==
+=JJFP
+-----END PGP MESSAGE-----
+
+--nextPart2479832.kuY37TRtyA
+Content-Disposition: attachment; filename="attachment.asc"
+Content-Transfer-Encoding: base64
+Content-Type: application/octet-stream; name="attachment.asc"
+
+hQEMAwzOQ1qnzNo7AQf/Z3qYebORMk5Z4R+Pmb6gBLA20G3yLRFyd0z+ygcEp+rc1jYE1ZqK1pFz
+Z6WLgPdMcyrKBLrDeDfsQRbKvimR7NaXLSuNkRHFtgqCmaFDyIUMcf9DobAoKvGvmBJhgMW7WPCA
+RUDaiJyqBp29nCQuOIqAiT5fm5LyyUmhRxUb9/CnulcxzW85EiITm0wMos30j1dU++3KDp5R6gcc
+9uUVbdCWdiF4j3ilE8flCWg9tARTRGinu4ENc9eIjcn1hCotFS+4ccWYIwf6ZkVDS4wNfU7dDg+9
+ZwNb+RkXuYXT/tFdir+ewV0Njaj0ZWTUrqZSk2ArmdGo9ou7xl/2mrK6YNJIAUKgVsQlWZ1Kx4PI
+0k0+TsJBgRzVNpIBHpmu0MI4CE03XHUslFhzdrjOG2Ts26U3EJw+jjssu0W4MVzYc20u3BgRnzHn
+/SFA
+
+
+--nextPart2479832.kuY37TRtyA--
+
diff --git a/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.html b/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.html
new file mode 100644
--- /dev/null
+++ b/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+ asfsadfsdaf
+
+ asdfasdfasdf
+
+ |
+
+
+ End of signed message |
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
+
+
+ The message is encrypted for the following keys: Hide Details
+ |
+
+
+
+
+ |
+
+
+ End of encrypted message |
+
+
+
+
+
+
+
diff --git a/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.tree b/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.tree
new file mode 100644
--- /dev/null
+++ b/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.tree
@@ -0,0 +1,8 @@
+ * MimeTreeParser::MessagePartList
+ * MimeTreeParser::MimeMessagePart
+ * MimeTreeParser::TextMessagePart
+ * MimeTreeParser::EncryptedMessagePart
+ * MimeTreeParser::SignedMessagePart
+ * MimeTreeParser::EncryptedMessagePart
+ * MimeTreeParser::TextMessagePart
+ * MimeTreeParser::MessagePart
diff --git a/mimetreeparser/src/bodyformatter/encrypted.cpp b/mimetreeparser/src/bodyformatter/encrypted.cpp
--- a/mimetreeparser/src/bodyformatter/encrypted.cpp
+++ b/mimetreeparser/src/bodyformatter/encrypted.cpp
@@ -27,6 +27,8 @@
#include
#include
+#include
+#include
#include
@@ -53,6 +55,13 @@
return MessagePart::Ptr();
}
+ QGpgME::QByteArrayDataProvider dp(node->decodedContent());
+ GpgME::Data data(&dp);
+
+ if (data.type() == GpgME::Data::Unknown) {
+ return nullptr;
+ }
+
const QGpgME::Protocol *useThisCryptProto = nullptr;
useThisCryptProto = QGpgME::openpgp();
@@ -83,14 +92,23 @@
return nullptr;
}
auto tempNode = new KMime::Content();
- qDebug() << part.nodeHelper()->codec(node)->name();
tempNode->contentType()->setCharset("utf-8");
tempNode->setBody(KMime::CRLFtoLF(part.nodeHelper()->codec(node)->fromUnicode(mp->text())));
tempNode->parse();
+ NodeHelper::magicSetType(tempNode);
+ if (node->topLevel()->textContent() != node && node->contentDisposition(false) && !tempNode->contentDisposition(false)) {
+ tempNode->contentDisposition()->setDisposition(node->contentDisposition()->disposition());
+ const auto fname = node->contentDisposition()->filename();
+ if (!fname.isEmpty()) {
+ tempNode->contentDisposition()->setFilename(fname);
+ }
+ }
if (!tempNode->head().isEmpty()) {
- tempNode->contentDescription()->from7BitString("encrypted data");
+ tempNode->contentDescription()->from7BitString("decrypted data");
}
+ tempNode->assemble();
+
part.nodeHelper()->cleanExtraContent(node);
mp->clearSubParts();
diff --git a/mimetreeparser/src/bodypartformatter.cpp b/mimetreeparser/src/bodypartformatter.cpp
--- a/mimetreeparser/src/bodypartformatter.cpp
+++ b/mimetreeparser/src/bodypartformatter.cpp
@@ -151,6 +151,7 @@
insert(QStringLiteral("application/pgp-encrypted"), ApplicationPGPEncryptedBodyPartFormatter::create());
insert(QStringLiteral("application/octet-stream"), ApplicationPkcs7MimeBodyPartFormatter::create());
+ insert(QStringLiteral("application/octet-stream"), EncryptedBodyPartFormatter::create());
insert(QStringLiteral("application/octet-stream"), AnyTypeBodyPartFormatter::create());
insert(QStringLiteral("text/pgp"), EncryptedBodyPartFormatter::create());