Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Messagelib
Commits
b6e09bc6
Commit
b6e09bc6
authored
Mar 31, 2016
by
Sandro Knauß
🐝
Browse files
use object parameters
parent
375bda85
Changes
2
Hide whitespace changes
Inline
Side-by-side
mimetreeparser/src/viewer/messagepart.cpp
View file @
b6e09bc6
...
...
@@ -1845,7 +1845,7 @@ void CryptoMessagePart::startDecryption(KMime::Content *data)
}
if
(
mMetaData
.
isSigned
)
{
sigStatusToMetaData
(
mSignatures
,
mCryptoProto
,
mMetaData
,
GpgME
::
Key
()
);
sigStatusToMetaData
();
mVerifiedText
=
mDecryptedData
;
}
...
...
@@ -1989,19 +1989,20 @@ static int signatureToStatus(const GpgME::Signature &sig)
}
}
void
CryptoMessagePart
::
sigStatusToMetaData
(
const
std
::
vector
<
GpgME
::
Signature
>
&
signatures
,
const
Kleo
::
CryptoBackend
::
Protocol
*
cryptProto
,
PartMetaData
&
messagePart
,
GpgME
::
Key
key
)
void
CryptoMessagePart
::
sigStatusToMetaData
()
{
if
(
messagePart
.
isSigned
)
{
GpgME
::
Signature
signature
=
signatures
.
front
();
messagePart
.
status_code
=
signatureToStatus
(
signature
);
messagePart
.
isGoodSignature
=
messagePart
.
status_code
&
GPGME_SIG_STAT_GOOD
;
GpgME
::
Key
key
;
if
(
mMetaData
.
isSigned
)
{
GpgME
::
Signature
signature
=
mSignatures
.
front
();
mMetaData
.
status_code
=
signatureToStatus
(
signature
);
mMetaData
.
isGoodSignature
=
mMetaData
.
status_code
&
GPGME_SIG_STAT_GOOD
;
// save extended signature status flags
m
essagePart
.
sigSummary
=
signature
.
summary
();
m
MetaData
.
sigSummary
=
signature
.
summary
();
if
(
m
essagePart
.
isGoodSignature
&&
!
key
.
keyID
())
{
if
(
m
MetaData
.
isGoodSignature
&&
!
key
.
keyID
())
{
// Search for the key by it's fingerprint so that we can check for
// trust etc.
Kleo
::
KeyListJob
*
job
=
c
ryptProto
->
keyListJob
(
false
);
// local, no sigs
Kleo
::
KeyListJob
*
job
=
mC
rypt
o
Proto
->
keyListJob
(
false
);
// local, no sigs
if
(
!
job
)
{
qCDebug
(
MIMETREEPARSER_LOG
)
<<
"The Crypto backend does not support listing keys. "
;
}
else
{
...
...
@@ -2025,14 +2026,14 @@ void CryptoMessagePart::sigStatusToMetaData(const std::vector <GpgME::Signature>
}
if
(
key
.
keyID
())
{
m
essagePart
.
keyId
=
key
.
keyID
();
m
MetaData
.
keyId
=
key
.
keyID
();
}
if
(
m
essagePart
.
keyId
.
isEmpty
())
{
m
essagePart
.
keyId
=
signature
.
fingerprint
();
if
(
m
MetaData
.
keyId
.
isEmpty
())
{
m
MetaData
.
keyId
=
signature
.
fingerprint
();
}
m
essagePart
.
keyTrust
=
signature
.
validity
();
m
MetaData
.
keyTrust
=
signature
.
validity
();
if
(
key
.
numUserIDs
()
>
0
&&
key
.
userID
(
0
).
id
())
{
m
essagePart
.
signer
=
Kleo
::
DN
(
key
.
userID
(
0
).
id
()).
prettyDN
();
m
MetaData
.
signer
=
Kleo
::
DN
(
key
.
userID
(
0
).
id
()).
prettyDN
();
}
for
(
uint
iMail
=
0
;
iMail
<
key
.
numUserIDs
();
++
iMail
)
{
// The following if /should/ always result in TRUE but we
...
...
@@ -2045,25 +2046,25 @@ void CryptoMessagePart::sigStatusToMetaData(const std::vector <GpgME::Signature>
email
=
email
.
mid
(
1
,
email
.
length
()
-
2
);
}
if
(
!
email
.
isEmpty
())
{
m
essagePart
.
signerMailAddresses
.
append
(
email
);
m
MetaData
.
signerMailAddresses
.
append
(
email
);
}
}
}
if
(
signature
.
creationTime
())
{
m
essagePart
.
creationTime
.
setTime_t
(
signature
.
creationTime
());
m
MetaData
.
creationTime
.
setTime_t
(
signature
.
creationTime
());
}
else
{
m
essagePart
.
creationTime
=
QDateTime
();
m
MetaData
.
creationTime
=
QDateTime
();
}
if
(
m
essagePart
.
signer
.
isEmpty
())
{
if
(
m
MetaData
.
signer
.
isEmpty
())
{
if
(
key
.
numUserIDs
()
>
0
&&
key
.
userID
(
0
).
name
())
{
m
essagePart
.
signer
=
Kleo
::
DN
(
key
.
userID
(
0
).
name
()).
prettyDN
();
m
MetaData
.
signer
=
Kleo
::
DN
(
key
.
userID
(
0
).
name
()).
prettyDN
();
}
if
(
!
m
essagePart
.
signerMailAddresses
.
empty
())
{
if
(
m
essagePart
.
signer
.
isEmpty
())
{
m
essagePart
.
signer
=
m
essagePart
.
signerMailAddresses
.
front
();
if
(
!
m
MetaData
.
signerMailAddresses
.
empty
())
{
if
(
m
MetaData
.
signer
.
isEmpty
())
{
m
MetaData
.
signer
=
m
MetaData
.
signerMailAddresses
.
front
();
}
else
{
m
essagePart
.
signer
+=
QLatin1String
(
" <"
)
+
m
essagePart
.
signerMailAddresses
.
front
()
+
QLatin1Char
(
'>'
);
m
MetaData
.
signer
+=
QLatin1String
(
" <"
)
+
m
MetaData
.
signerMailAddresses
.
front
()
+
QLatin1Char
(
'>'
);
}
}
}
...
...
@@ -2087,7 +2088,7 @@ void CryptoMessagePart::startVerificationDetached(const QByteArray &text, KMime:
okVerify
(
text
,
signature
);
if
(
mMetaData
.
isSigned
)
{
sigStatusToMetaData
(
mSignatures
,
mCryptoProto
,
mMetaData
,
GpgME
::
Key
()
);
sigStatusToMetaData
();
}
else
{
mMetaData
.
creationTime
=
QDateTime
();
}
...
...
mimetreeparser/src/viewer/messagepart.h
View file @
b6e09bc6
...
...
@@ -444,7 +444,7 @@ private:
*/
bool
okVerify
(
const
QByteArray
&
data
,
const
QByteArray
&
signature
);
void
sigStatusToMetaData
(
const
std
::
vector
<
GpgME
::
Signature
>
&
signatures
,
const
Kleo
::
CryptoBackend
::
Protocol
*
cryptProto
,
PartMetaData
&
messagePart
,
GpgME
::
Key
key
);
void
sigStatusToMetaData
();
protected:
bool
mPassphraseError
;
bool
mNoSecKey
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment