mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Bugfix: #342
This commit is contained in:
parent
7da5692865
commit
355f6158be
|
@ -1474,7 +1474,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
: await this.mailvelope.encrypt(recipients);
|
||||
/*
|
||||
Object.entries(PgpUserStore.getPublicKeyOfEmails(recipients) || {}).forEach(([k,v]) =>
|
||||
params.autocrypt.push({addr:k, keydata:v.replace(/-----(BEGIN|END) PGP PUBLIC KEY BLOCK-----/).trim()})
|
||||
params.autocrypt.push({addr:k, keydata:v.replace(/-----(BEGIN|END) PGP PUBLIC KEY BLOCK-----/g).trim()})
|
||||
);
|
||||
*/
|
||||
} else if (sign || encrypt) {
|
||||
|
@ -1525,7 +1525,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
}
|
||||
if (encrypt) {
|
||||
Object.entries(PgpUserStore.getPublicKeyOfEmails(recipients) || {}).forEach(([k,v]) =>
|
||||
params.autocrypt.push({addr:k, keydata:v.replace(/-----(BEGIN|END) PGP PUBLIC KEY BLOCK-----/).trim()})
|
||||
params.autocrypt.push({addr:k, keydata:v.replace(/-----(BEGIN|END) PGP PUBLIC KEY BLOCK-----/g, '').trim()})
|
||||
);
|
||||
if ('openpgp' == encrypt) {
|
||||
// Doesn't encrypt attachments
|
||||
|
|
|
@ -157,6 +157,12 @@ class Message extends Part
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function SetAutocrypt(array $aValue) : self
|
||||
{
|
||||
$this->aHeadersValue['Autocrypt'] = $aValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function SetSubject(string $sSubject) : self
|
||||
{
|
||||
$this->aHeadersValue[Enumerations\Header::SUBJECT] = $sSubject;
|
||||
|
@ -415,7 +421,11 @@ class Message extends Part
|
|||
}
|
||||
|
||||
foreach ($this->aHeadersValue as $sName => $mValue) {
|
||||
if (!($bWithoutBcc && \strtolower(Enumerations\Header::BCC) === \strtolower($sName))) {
|
||||
if ('autocrypt' === \strtolower($sName)) {
|
||||
foreach ($mValue as $key) {
|
||||
$oRootPart->Headers->AddByName($sName, $key);
|
||||
}
|
||||
} else if (!($bWithoutBcc && \strtolower(Enumerations\Header::BCC) === \strtolower($sName))) {
|
||||
$oRootPart->Headers->SetByName($sName, (string) $mValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1035,9 +1035,9 @@ trait Messages
|
|||
$oMessage->SetReferences($this->GetActionParam('references', ''));
|
||||
|
||||
$aAutocrypt = $this->GetActionParam('autocrypt', []);
|
||||
foreach ($aAutocrypt as $header) {
|
||||
$oMessage->SetCustomHeader('Autocrypt', "addr={$header['addr']}; keydata={$header['keydata']}");
|
||||
}
|
||||
$oMessage->SetAutocrypt(
|
||||
\array_map(fn($header)=>"addr={$header['addr']}; keydata={$header['keydata']}", $aAutocrypt)
|
||||
);
|
||||
|
||||
$aFoundCids = array();
|
||||
$aFoundDataURL = array();
|
||||
|
|
Loading…
Reference in a new issue