summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/composercontroller.cpp
diff options
context:
space:
mode:
authorRémi Nicole <nicole@kolabsystems.com>2018-03-08 12:09:25 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-08 12:11:03 +0100
commit4f006ff552a5ecf4550554d53ece8f4e9c1b9dc0 (patch)
treed367daa985f82a0673cf2f5c4140c1a81e90152e /framework/src/domain/composercontroller.cpp
parentfa04490373f4f09dfadfdc3450eb98a4514072e7 (diff)
downloadkube-4f006ff552a5ecf4550554d53ece8f4e9c1b9dc0.tar.gz
kube-4f006ff552a5ecf4550554d53ece8f4e9c1b9dc0.zip
Support encrypted mails forwarding
Summary: Some notes: - What we do is: if the mail is encrypted, decrypt it and copy its content into a new message (with plaintext, html and attachments, if any), and use this message as attachment for forwarding - The `isEncrypted` function from KMime doesn't seem to detect every kind of encrypted mails. AFAIK this structure is not detected: - `multipart/mixed` - `text/plain` - `application/pgp-encrypted` (attachement, named "ATT00001") - `application/octet-stream` (attachment named "encrypted.asc") Reviewers: cmollekopf Tags: PHID-PROJ-6npnfcmppynqynn7slmv Maniphest Tasks: T8112, T7024 Differential Revision: https://phabricator.kde.org/D10966
Diffstat (limited to 'framework/src/domain/composercontroller.cpp')
-rw-r--r--framework/src/domain/composercontroller.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/framework/src/domain/composercontroller.cpp b/framework/src/domain/composercontroller.cpp
index 09d4c154..2286a71b 100644
--- a/framework/src/domain/composercontroller.cpp
+++ b/framework/src/domain/composercontroller.cpp
@@ -99,19 +99,19 @@ class AddresseeController : public Kube::ListPropertyController
99public: 99public:
100 100
101 bool mFoundAllKeys = true; 101 bool mFoundAllKeys = true;
102
102 QSet<QByteArray> mMissingKeys; 103 QSet<QByteArray> mMissingKeys;
103 AddresseeController() 104 AddresseeController() : Kube::ListPropertyController{{"name", "keyFound", "key"}}
104 : Kube::ListPropertyController{{"name", "keyFound", "key"}}
105 { 105 {
106 QObject::connect(this, &Kube::ListPropertyController::added, this, [this] (const QByteArray &id, const QVariantMap &map) { 106 QObject::connect(
107 findKey(id, map.value("name").toString()); 107 this, &Kube::ListPropertyController::added, this, [this](const QByteArray &id, const QVariantMap &map) {
108 }); 108 findKey(id, map.value("name").toString());
109 });
110
109 QObject::connect(this, &Kube::ListPropertyController::removed, this, [this] (const QByteArray &id) { 111 QObject::connect(this, &Kube::ListPropertyController::removed, this, [this] (const QByteArray &id) {
110 mMissingKeys.remove(id); 112 mMissingKeys.remove(id);
111 setFoundAllKeys(mMissingKeys.isEmpty()); 113 setFoundAllKeys(mMissingKeys.isEmpty());
112 }); 114 });
113
114
115 } 115 }
116 116
117 bool foundAllKeys() 117 bool foundAllKeys()
@@ -133,12 +133,13 @@ public:
133 mb.fromUnicodeString(addressee); 133 mb.fromUnicodeString(addressee);
134 134
135 SinkLog() << "Searching key for: " << mb.address(); 135 SinkLog() << "Searching key for: " << mb.address();
136 asyncRun<std::vector<GpgME::Key>>(this, [mb] { 136 asyncRun<std::vector<GpgME::Key>>(this,
137 [mb] {
137 return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP); 138 return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP);
138 }, 139 },
139 [this, addressee, id](const std::vector<GpgME::Key> &keys) { 140 [this, addressee, id](const std::vector<GpgME::Key> &keys) {
140 if (!keys.empty()) { 141 if (!keys.empty()) {
141 if (keys.size() > 1 ) { 142 if (keys.size() > 1) {
142 SinkWarning() << "Found more than one key, encrypting to all of them."; 143 SinkWarning() << "Found more than one key, encrypting to all of them.";
143 } 144 }
144 SinkLog() << "Found key: " << keys.front().primaryFingerprint(); 145 SinkLog() << "Found key: " << keys.front().primaryFingerprint();
@@ -154,7 +155,7 @@ public:
154 155
155 void set(const QStringList &list) 156 void set(const QStringList &list)
156 { 157 {
157 for (const auto &email: list) { 158 for (const auto &email : list) {
158 add({{"name", email}}); 159 add({{"name", email}});
159 } 160 }
160 } 161 }