From 05d8e7b353142830fd31d4861d27ddbe3ac9045f Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 7 Feb 2023 15:25:28 +0100 Subject: [PATCH] Improved autocrypt #342 --- dev/Model/Message.js | 2 +- dev/View/Popup/Compose.js | 2 ++ .../v/0.0.0/app/libraries/MailSo/Mail/Message.php | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dev/Model/Message.js b/dev/Model/Message.js index d7064fafe..bd6388051 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -75,6 +75,7 @@ export class MessageModel extends AbstractModel { this.messageId = ''; this.inReplyTo = ''; this.references = ''; + this.autocrypt = {}; addObservablesTo(this, { subject: '', @@ -111,7 +112,6 @@ export class MessageModel extends AbstractModel { readReceipt: '', - autocrypt: '', // rfc8621 id: '', // threadId: '', diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index e85613f95..9ba7e67cd 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -840,6 +840,8 @@ export class ComposePopupView extends AbstractViewPopup { this.aDraftInfo = ['reply', message.uid, message.folder]; this.sInReplyTo = message.messageId; this.sReferences = (message.messageId + ' ' + message.references).trim(); + // OpenPGP “Transferable Public Key” +// message.autocrypt?.keydata break; case ComposeType.Forward: diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php index e6003b9a0..1bb620a4d 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php @@ -485,6 +485,14 @@ class Message implements \JsonSerializable $this->aFlagsLowerCase )); + $aAutocrypt = []; + if ($this->sAutocrypt) { + foreach (\explode(';', $this->sAutocrypt) as $entry) { + $entry = \explode('=', \trim($entry), 2); + $aAutocrypt[$entry[0]] = $entry[1]; + } + } + return array( '@Object' => 'Object/Message', 'folder' => $this->sFolder, @@ -512,7 +520,7 @@ class Message implements \JsonSerializable 'threads' => $this->aThreads, 'unsubsribeLinks' => $this->UnsubsribeLinks, 'readReceipt' => '', - 'autocrypt' => $this->sAutocrypt, + 'autocrypt' => $aAutocrypt ?: null, 'attachments' => $this->Attachments,