Improved autocrypt #342

This commit is contained in:
the-djmaze 2023-02-07 15:25:28 +01:00
parent 636ffe5fbb
commit 05d8e7b353
3 changed files with 12 additions and 2 deletions

View file

@ -75,6 +75,7 @@ export class MessageModel extends AbstractModel {
this.messageId = ''; this.messageId = '';
this.inReplyTo = ''; this.inReplyTo = '';
this.references = ''; this.references = '';
this.autocrypt = {};
addObservablesTo(this, { addObservablesTo(this, {
subject: '', subject: '',
@ -111,7 +112,6 @@ export class MessageModel extends AbstractModel {
readReceipt: '', readReceipt: '',
autocrypt: '',
// rfc8621 // rfc8621
id: '', id: '',
// threadId: '', // threadId: '',

View file

@ -840,6 +840,8 @@ export class ComposePopupView extends AbstractViewPopup {
this.aDraftInfo = ['reply', message.uid, message.folder]; this.aDraftInfo = ['reply', message.uid, message.folder];
this.sInReplyTo = message.messageId; this.sInReplyTo = message.messageId;
this.sReferences = (message.messageId + ' ' + message.references).trim(); this.sReferences = (message.messageId + ' ' + message.references).trim();
// OpenPGP “Transferable Public Key”
// message.autocrypt?.keydata
break; break;
case ComposeType.Forward: case ComposeType.Forward:

View file

@ -485,6 +485,14 @@ class Message implements \JsonSerializable
$this->aFlagsLowerCase $this->aFlagsLowerCase
)); ));
$aAutocrypt = [];
if ($this->sAutocrypt) {
foreach (\explode(';', $this->sAutocrypt) as $entry) {
$entry = \explode('=', \trim($entry), 2);
$aAutocrypt[$entry[0]] = $entry[1];
}
}
return array( return array(
'@Object' => 'Object/Message', '@Object' => 'Object/Message',
'folder' => $this->sFolder, 'folder' => $this->sFolder,
@ -512,7 +520,7 @@ class Message implements \JsonSerializable
'threads' => $this->aThreads, 'threads' => $this->aThreads,
'unsubsribeLinks' => $this->UnsubsribeLinks, 'unsubsribeLinks' => $this->UnsubsribeLinks,
'readReceipt' => '', 'readReceipt' => '',
'autocrypt' => $this->sAutocrypt, 'autocrypt' => $aAutocrypt ?: null,
'attachments' => $this->Attachments, 'attachments' => $this->Attachments,