mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-09 08:17:53 +08:00
Cleaner DoMessagePgpVerify result
This commit is contained in:
parent
7ef1a8f14a
commit
87548632a9
1 changed files with 13 additions and 15 deletions
|
@ -682,26 +682,26 @@ trait Messages
|
|||
|
||||
if ($sSigPartId) {
|
||||
$result = [
|
||||
'Text' => \preg_replace('/\\R/s', "\r\n",
|
||||
'text' => \preg_replace('/\\R/s', "\r\n",
|
||||
$oFetchResponse->GetFetchValue(FetchType::BODY.'['.$sBodyPartId.'.MIME]')
|
||||
. $oFetchResponse->GetFetchValue(FetchType::BODY.'['.$sBodyPartId.']')
|
||||
),
|
||||
'Signature' => preg_replace('/[^\x00-\x7F]/', '',
|
||||
'signature' => preg_replace('/[^\x00-\x7F]/', '',
|
||||
$oFetchResponse->GetFetchValue(FetchType::BODY.'['.$sSigPartId.']')
|
||||
)
|
||||
];
|
||||
} else {
|
||||
// clearsigned text
|
||||
$result = [
|
||||
'Text' => \preg_replace('/\\R/s', "\r\n",
|
||||
'text' => \preg_replace('/\\R/s', "\r\n",
|
||||
$oFetchResponse->GetFetchValue(FetchType::BODY.'['.$sBodyPartId.']')
|
||||
),
|
||||
'Signature' => false
|
||||
'signature' => false
|
||||
];
|
||||
}
|
||||
|
||||
if (\class_exists('gnupg')) {
|
||||
$info = $this->GnuPG()->verify($result['Text'], $result['Signature'])[0];
|
||||
$info = $this->GnuPG()->verify($result['text'], $result['signature'])[0];
|
||||
|
||||
/**
|
||||
* https://code.woboq.org/qt5/include/gpg-error.h.html
|
||||
|
@ -727,17 +727,15 @@ trait Messages
|
|||
// GNUPG_SIGSUM_TOFU_CONFLICT = 'A TOFU conflict was detected.',
|
||||
];
|
||||
|
||||
// Verified, so no need to return $result['Text'] and $result['Signature']
|
||||
// Verified, so no need to return $result['text'] and $result['signature']
|
||||
$result = [
|
||||
'Result' => [
|
||||
'fingerprint' => $info['fingerprint'],
|
||||
'validity' => $info['validity'],
|
||||
'status' => $info['status'],
|
||||
'summary' => $info['summary'],
|
||||
'message' => \implode("\n", \array_filter($summary, function($k) use ($info) {
|
||||
return $info['summary'] & $k;
|
||||
}, ARRAY_FILTER_USE_KEY))
|
||||
]
|
||||
'fingerprint' => $info['fingerprint'],
|
||||
'validity' => $info['validity'],
|
||||
'status' => $info['status'],
|
||||
'summary' => $info['summary'],
|
||||
'message' => \implode("\n", \array_filter($summary, function($k) use ($info) {
|
||||
return $info['summary'] & $k;
|
||||
}, ARRAY_FILTER_USE_KEY))
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue