summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/composercontroller.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-05 10:39:32 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-06 17:21:01 +0200
commit01594e68275a09c67b5ee258e2af86598118a6a0 (patch)
tree4f859815f6455906bb656f9cc27ba5d6e4111599 /framework/src/domain/composercontroller.cpp
parent481cb9f600caf3f45596bf78b5ba2bd07007969c (diff)
downloadkube-01594e68275a09c67b5ee258e2af86598118a6a0.tar.gz
kube-01594e68275a09c67b5ee258e2af86598118a6a0.zip
Port to gpgme only.
QGpgme and Gpgmepp are not readily available, the cmake files buggy, the buildsystem horrendous and generally just difficult to build on windows. Given that all they are is a wrapper around gpgme, we're better of without all the indirections. What we loose is: * QGpgme moved the work to separate threads (but we then blocked anyways), something that we can just do in our own code should we want to. * QGpgme has a function to prettify dn's that was used to show the signer. Also something we could bring back should we need to (don't know where it is useful atm.) Ported messagepart to gpgme Almost there Moved the crypto bits to a separate file All gpg code is in one place. All tests passing Use error codes Cleanup
Diffstat (limited to 'framework/src/domain/composercontroller.cpp')
-rw-r--r--framework/src/domain/composercontroller.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/framework/src/domain/composercontroller.cpp b/framework/src/domain/composercontroller.cpp
index fc436003..88c0c839 100644
--- a/framework/src/domain/composercontroller.cpp
+++ b/framework/src/domain/composercontroller.cpp
@@ -36,7 +36,7 @@
36#include "mime/mailcrypto.h" 36#include "mime/mailcrypto.h"
37#include "async.h" 37#include "async.h"
38 38
39std::vector<MailCrypto::Key> &operator+=(std::vector<MailCrypto::Key> &list, const std::vector<MailCrypto::Key> &add) 39std::vector<Crypto::Key> &operator+=(std::vector<Crypto::Key> &list, const std::vector<Crypto::Key> &add)
40{ 40{
41 list.insert(std::end(list), std::begin(add), std::end(add)); 41 list.insert(std::end(list), std::begin(add), std::end(add));
42 return list; 42 return list;
@@ -133,11 +133,11 @@ 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<MailCrypto::Key>>(this, 136 asyncRun<std::vector<Crypto::Key>>(this,
137 [mb] { 137 [mb] {
138 return MailCrypto::findKeys(QStringList{} << mb.address(), false, false); 138 return Crypto::findKeys(QStringList{} << mb.address(), false, false);
139 }, 139 },
140 [this, addressee, id](const std::vector<MailCrypto::Key> &keys) { 140 [this, addressee, id](const std::vector<Crypto::Key> &keys) {
141 if (!keys.empty()) { 141 if (!keys.empty()) {
142 if (keys.size() > 1) { 142 if (keys.size() > 1) {
143 SinkWarning() << "Found more than one key, encrypting to all of them."; 143 SinkWarning() << "Found more than one key, encrypting to all of them.";
@@ -227,10 +227,10 @@ void ComposerController::findPersonalKey()
227{ 227{
228 auto identity = getIdentity(); 228 auto identity = getIdentity();
229 SinkLog() << "Looking for personal key for: " << identity.address(); 229 SinkLog() << "Looking for personal key for: " << identity.address();
230 asyncRun<std::vector<MailCrypto::Key>>(this, [=] { 230 asyncRun<std::vector<Crypto::Key>>(this, [=] {
231 return MailCrypto::findKeys(QStringList{} << identity.address(), true); 231 return Crypto::findKeys(QStringList{} << identity.address(), true);
232 }, 232 },
233 [this](const std::vector<MailCrypto::Key> &keys) { 233 [this](const std::vector<Crypto::Key> &keys) {
234 if (keys.empty()) { 234 if (keys.empty()) {
235 SinkWarning() << "Failed to find a personal key."; 235 SinkWarning() << "Failed to find a personal key.";
236 } else if (keys.size() > 1) { 236 } else if (keys.size() > 1) {
@@ -419,23 +419,23 @@ void ComposerController::recordForAutocompletion(const QByteArray &addrSpec, con
419 } 419 }
420} 420}
421 421
422std::vector<MailCrypto::Key> ComposerController::getRecipientKeys() 422std::vector<Crypto::Key> ComposerController::getRecipientKeys()
423{ 423{
424 std::vector<MailCrypto::Key> keys; 424 std::vector<Crypto::Key> keys;
425 { 425 {
426 const auto list = toController()->getList<std::vector<MailCrypto::Key>>("key"); 426 const auto list = toController()->getList<std::vector<Crypto::Key>>("key");
427 for (const auto &l: list) { 427 for (const auto &l: list) {
428 keys.insert(std::end(keys), std::begin(l), std::end(l)); 428 keys.insert(std::end(keys), std::begin(l), std::end(l));
429 } 429 }
430 } 430 }
431 { 431 {
432 const auto list = ccController()->getList<std::vector<MailCrypto::Key>>("key"); 432 const auto list = ccController()->getList<std::vector<Crypto::Key>>("key");
433 for (const auto &l: list) { 433 for (const auto &l: list) {
434 keys.insert(std::end(keys), std::begin(l), std::end(l)); 434 keys.insert(std::end(keys), std::begin(l), std::end(l));
435 } 435 }
436 } 436 }
437 { 437 {
438 const auto list = bccController()->getList<std::vector<MailCrypto::Key>>("key"); 438 const auto list = bccController()->getList<std::vector<Crypto::Key>>("key");
439 for (const auto &l: list) { 439 for (const auto &l: list) {
440 keys.insert(std::end(keys), std::begin(l), std::end(l)); 440 keys.insert(std::end(keys), std::begin(l), std::end(l));
441 } 441 }
@@ -463,17 +463,17 @@ KMime::Message::Ptr ComposerController::assembleMessage()
463 }; 463 };
464 }); 464 });
465 465
466 MailCrypto::Key attachedKey; 466 Crypto::Key attachedKey;
467 std::vector<MailCrypto::Key> signingKeys; 467 std::vector<Crypto::Key> signingKeys;
468 if (getSign()) { 468 if (getSign()) {
469 signingKeys = getPersonalKeys().value<std::vector<MailCrypto::Key>>(); 469 signingKeys = getPersonalKeys().value<std::vector<Crypto::Key>>();
470 Q_ASSERT(!signingKeys.empty()); 470 Q_ASSERT(!signingKeys.empty());
471 attachedKey = signingKeys[0]; 471 attachedKey = signingKeys[0];
472 } 472 }
473 std::vector<MailCrypto::Key> encryptionKeys; 473 std::vector<Crypto::Key> encryptionKeys;
474 if (getEncrypt()) { 474 if (getEncrypt()) {
475 //Encrypt to self so we can read the sent message 475 //Encrypt to self so we can read the sent message
476 auto personalKeys = getPersonalKeys().value<std::vector<MailCrypto::Key>>(); 476 auto personalKeys = getPersonalKeys().value<std::vector<Crypto::Key>>();
477 477
478 attachedKey = personalKeys[0]; 478 attachedKey = personalKeys[0];
479 479