diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-20 19:18:02 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-20 19:22:15 +0100 |
commit | 6299a2fee34e53938d7c230e7e29611a6bcdb2b9 (patch) | |
tree | e09a37f1284fb0c0b170624464795fe14a5bd392 /framework/src | |
parent | f92a5ff29d728cd9cc4dbe5819d7b43287f802e3 (diff) | |
download | kube-6299a2fee34e53938d7c230e7e29611a6bcdb2b9.tar.gz kube-6299a2fee34e53938d7c230e7e29611a6bcdb2b9.zip |
This is really a boolean in disguise
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/messagepart.cpp | 14 | ||||
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/messagepart.h | 3 |
2 files changed, 8 insertions, 9 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/messagepart.cpp b/framework/src/domain/mime/mimetreeparser/messagepart.cpp index e628645c..5f14b7bd 100644 --- a/framework/src/domain/mime/mimetreeparser/messagepart.cpp +++ b/framework/src/domain/mime/mimetreeparser/messagepart.cpp | |||
@@ -866,13 +866,13 @@ void SignedMessagePart::startVerificationDetached(const QByteArray &text, KMime: | |||
866 | if (!signature.isEmpty()) { | 866 | if (!signature.isEmpty()) { |
867 | qWarning() << "We have a signature"; | 867 | qWarning() << "We have a signature"; |
868 | auto result = ctx->verifyDetachedSignature(fromBA(signature), fromBA(text)); | 868 | auto result = ctx->verifyDetachedSignature(fromBA(signature), fromBA(text)); |
869 | setVerificationResult(result, textNode, text); | 869 | setVerificationResult(result, false, text); |
870 | } else { | 870 | } else { |
871 | qWarning() << "We have no signature"; | 871 | qWarning() << "We have no signature"; |
872 | QGpgME::QByteArrayDataProvider out; | 872 | QGpgME::QByteArrayDataProvider out; |
873 | GpgME::Data outdata(&out); | 873 | GpgME::Data outdata(&out); |
874 | auto result = ctx->verifyOpaqueSignature(fromBA(text), outdata); | 874 | auto result = ctx->verifyOpaqueSignature(fromBA(text), outdata); |
875 | setVerificationResult(result, textNode, out.data()); | 875 | setVerificationResult(result, false, out.data()); |
876 | } | 876 | } |
877 | 877 | ||
878 | if (!mMetaData.isSigned) { | 878 | if (!mMetaData.isSigned) { |
@@ -880,7 +880,7 @@ void SignedMessagePart::startVerificationDetached(const QByteArray &text, KMime: | |||
880 | } | 880 | } |
881 | } | 881 | } |
882 | 882 | ||
883 | void SignedMessagePart::setVerificationResult(const GpgME::VerificationResult &result, KMime::Content *textNode, const QByteArray &plainText) | 883 | void SignedMessagePart::setVerificationResult(const GpgME::VerificationResult &result, bool parseText, const QByteArray &plainText) |
884 | { | 884 | { |
885 | auto signatures = result.signatures(); | 885 | auto signatures = result.signatures(); |
886 | mVerifiedText = plainText; | 886 | mVerifiedText = plainText; |
@@ -888,12 +888,10 @@ void SignedMessagePart::setVerificationResult(const GpgME::VerificationResult &r | |||
888 | if (!signatures.empty()) { | 888 | if (!signatures.empty()) { |
889 | mMetaData.isSigned = true; | 889 | mMetaData.isSigned = true; |
890 | sigStatusToMetaData(signatures.front()); | 890 | sigStatusToMetaData(signatures.front()); |
891 | if (mNode && !textNode) { | 891 | if (mNode && parseText) { |
892 | mOtp->mNodeHelper->setPartMetaData(mNode, mMetaData); | 892 | mOtp->mNodeHelper->setPartMetaData(mNode, mMetaData); |
893 | } | 893 | } |
894 | 894 | if (!mVerifiedText.isEmpty() && parseText) { | |
895 | if (!mVerifiedText.isEmpty() && !textNode) { | ||
896 | |||
897 | auto tempNode = new KMime::Content(); | 895 | auto tempNode = new KMime::Content(); |
898 | tempNode->setContent(KMime::CRLFtoLF(mVerifiedText.constData())); | 896 | tempNode->setContent(KMime::CRLFtoLF(mVerifiedText.constData())); |
899 | tempNode->parse(); | 897 | tempNode->parse(); |
@@ -1013,7 +1011,7 @@ bool EncryptedMessagePart::okDecryptMIME(KMime::Content &data) | |||
1013 | if (verifyResult.signatures().size() > 0) { | 1011 | if (verifyResult.signatures().size() > 0) { |
1014 | //We simply attach a signed message part to indicate that this content is also signed | 1012 | //We simply attach a signed message part to indicate that this content is also signed |
1015 | auto subPart = SignedMessagePart::Ptr(new SignedMessagePart(mOtp, QString::fromUtf8(plainText), mProtocol, mFromAddress, nullptr, nullptr)); | 1013 | auto subPart = SignedMessagePart::Ptr(new SignedMessagePart(mOtp, QString::fromUtf8(plainText), mProtocol, mFromAddress, nullptr, nullptr)); |
1016 | subPart->setVerificationResult(verifyResult, nullptr, plainText); | 1014 | subPart->setVerificationResult(verifyResult, true, plainText); |
1017 | appendSubPart(subPart); | 1015 | appendSubPart(subPart); |
1018 | } | 1016 | } |
1019 | 1017 | ||
diff --git a/framework/src/domain/mime/mimetreeparser/messagepart.h b/framework/src/domain/mime/mimetreeparser/messagepart.h index 75208e52..b958ae8e 100644 --- a/framework/src/domain/mime/mimetreeparser/messagepart.h +++ b/framework/src/domain/mime/mimetreeparser/messagepart.h | |||
@@ -364,7 +364,8 @@ public: | |||
364 | 364 | ||
365 | private: | 365 | private: |
366 | void sigStatusToMetaData(const GpgME::Signature &signature); | 366 | void sigStatusToMetaData(const GpgME::Signature &signature); |
367 | void setVerificationResult(const GpgME::VerificationResult &result, KMime::Content *textNode, const QByteArray &plainText); | 367 | void setVerificationResult(const GpgME::VerificationResult &result, bool parseText, const QByteArray &plainText); |
368 | |||
368 | protected: | 369 | protected: |
369 | GpgME::Protocol mProtocol; | 370 | GpgME::Protocol mProtocol; |
370 | QString mFromAddress; | 371 | QString mFromAddress; |