Skip to content

Commit

Permalink
Use JMAP rfc8621 section-4 subject and receivedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Jun 1, 2022
1 parent 118505f commit a43fadb
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dev/Stores/User/Messagelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ MessagelistUserStore.initUidNextAndNewMessages = (folder, uidNext, newMessages)
newMessages.forEach(item => {
NotificationUserStore.displayDesktopNotification(
EmailCollectionModel.reviveFromJson(item.From).toString(),
item.Subject,
item.subject,
{ Folder: item.Folder, Uid: item.Uid }
);
});
Expand Down
2 changes: 1 addition & 1 deletion dev/View/Popup/Compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export class ComposePopupView extends AbstractViewPopup {
Cc: this.cc(),
Bcc: this.bcc(),
ReplyTo: this.replyTo(),
Subject: this.subject(),
subject: this.subject(),
DraftInfo: this.aDraftInfo,
InReplyTo: this.sInReplyTo,
References: this.sReferences,
Expand Down
2 changes: 1 addition & 1 deletion dev/View/User/MailBox/MessageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ export class MailMessageView extends AbstractViewRight {
MessageFolder: oMessage.folder,
MessageUid: oMessage.uid,
ReadReceipt: oMessage.readReceipt(),
Subject: i18n('READ_RECEIPT/SUBJECT', { SUBJECT: oMessage.subject() }),
subject: i18n('READ_RECEIPT/SUBJECT', { SUBJECT: oMessage.subject() }),
Text: i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountUserStore.email() })
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ private function getFolderNextMessageInformation(string $sFolderName, int $iPrev
$aNewMessages[] = array(
'Folder' => $sFolderName,
'Uid' => $iUid,
'Subject' => $oHeaders->ValueByName(MimeHeader::SUBJECT, !$sContentTypeCharset),
'subject' => $oHeaders->ValueByName(MimeHeader::SUBJECT, !$sContentTypeCharset),
'From' => $oHeaders->GetAsEmailCollection(MimeHeader::FROM_, !$sContentTypeCharset)
);
}
Expand Down
10 changes: 7 additions & 3 deletions snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,8 @@ public function jsonSerialize()
'@Object' => 'Object/Message',
'Folder' => $this->sFolder,
'Uid' => $this->iUid,
'Subject' => \trim(Utils::Utf8Clear($this->sSubject)),
'subject' => \trim(Utils::Utf8Clear($this->sSubject)),
'MessageId' => $this->sMessageId,
'Size' => $this->iSize,
'SpamScore' => $this->bIsSpam ? 100 : $this->iSpamScore,
'SpamResult' => $this->sSpamResult,
'IsSpam' => $this->bIsSpam,
Expand All @@ -658,7 +657,12 @@ public function jsonSerialize()

'Attachments' => $this->oAttachments ? $this->oAttachments->SpecData() : null,

'Flags' => $this->aFlagsLowerCase
'Flags' => $this->aFlagsLowerCase,

// https://datatracker.ietf.org/doc/html/rfc8621#section-4.1.1
'size' => $this->iSize,
'receivedAt' => \gmdate('Y-m-d\\TH:i:s\\Z', $this->iInternalTimeStampInUTC)
// 'keywords' => \array_fill_keys($this->aFlagsLowerCase, true)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ private function cacherForThreads()
private function buildReadReceiptMessage(Account $oAccount) : \MailSo\Mime\Message
{
$sReadReceipt = $this->GetActionParam('ReadReceipt', '');
$sSubject = $this->GetActionParam('Subject', '');
$sSubject = $this->GetActionParam('subject', '');
$sText = $this->GetActionParam('Text', '');

$oIdentity = $this->GetIdentityByID($oAccount, '', true);
Expand Down Expand Up @@ -1084,7 +1084,7 @@ private function buildMessage(Account $oAccount, bool $bWithDraftInfo = true) :
$oMessage->SetPriority(\MailSo\Mime\Enumerations\MessagePriority::HIGH);
}

$oMessage->SetSubject($this->GetActionParam('Subject', ''));
$oMessage->SetSubject($this->GetActionParam('subject', ''));

$oToEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('To', ''));
if ($oToEmails->count()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private function responseObject($mResponse, string $sParent = '')
$mResult[$prop] = $this->responseObject($mResult[$prop], $sParent);
}

$sSubject = $mResult['Subject'];
$sSubject = $mResult['subject'];
$mResult['Hash'] = \md5($mResult['Folder'].$mResult['Uid']);
$mResult['RequestHash'] = Utils::EncodeKeyValuesQ(array(
'V' => APP_VERSION,
Expand Down

0 comments on commit a43fadb

Please sign in to comment.