diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 0db1a79f7..b54868823 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -85,7 +85,8 @@ export class MessageModel extends AbstractModel { spamResult: '', isSpam: false, hasVirus: null, // or boolean when scanned - dateTimeStampInUTC: 0, + dateTimestamp: 0, + internalTimestamp: 0, priority: MessagePriority.Normal, senderEmailsString: '', @@ -341,7 +342,7 @@ export class MessageModel extends AbstractModel { viewPopupMessage(print) { const - timeStampInUTC = this.dateTimeStampInUTC() || 0, + timeStampInUTC = this.dateTimestamp() || 0, ccLine = this.cc.toString(), bccLine = this.bcc.toString(), m = 0 < timeStampInUTC ? new Date(timeStampInUTC * 1000) : null, diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 8ccb0ad79..670e5890e 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -172,7 +172,7 @@ export class MailMessageList extends AbstractViewRight { rtf = Intl.RelativeTimeFormat ? new Intl.RelativeTimeFormat(doc.documentElement.lang, { numeric: "auto" }) : 0; MessagelistUserStore.forEach(msg => { - let dt = (new Date(msg.dateTimeStampInUTC() * 1000)), + let dt = (new Date(msg.dateTimestamp() * 1000)), date, ymd = Ymd(dt); if (!current || ymd != current.id) { 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 55d743fc7..252438df1 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 @@ -48,7 +48,7 @@ class Message implements \JsonSerializable $iSize = 0, $SpamScore = 0, $iInternalTimeStampInUTC = 0, - $HeaderTimeStampInUTC = 0, + $iHeaderTimeStampInUTC = 0, $iPriority = \MailSo\Mime\Enumerations\MessagePriority::NORMAL; private bool @@ -107,26 +107,11 @@ class Message implements \JsonSerializable return $this->Uid; } - public function HeaderTimeStampInUTC() : int - { - return $this->HeaderTimeStampInUTC; - } - public function Attachments() : ?AttachmentCollection { return $this->Attachments; } - public function Plain() : string - { - return $this->sPlain; - } - - public function Html() : string - { - return $this->sHtml; - } - private function setSpamScore($value) : void { $this->SpamScore = \intval(\max(0, \min(100, $value))); @@ -200,7 +185,7 @@ class Message implements \JsonSerializable $oMessage->References = Utils::StripSpaces( $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::REFERENCES)); - $oMessage->HeaderTimeStampInUTC = \MailSo\Base\DateTimeHelper::ParseRFC2822DateString( + $oMessage->iHeaderTimeStampInUTC = \MailSo\Base\DateTimeHelper::ParseRFC2822DateString( $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::DATE) ); @@ -507,6 +492,21 @@ class Message implements \JsonSerializable } } + $aFlags = $this->getFlags(); + $sReadReceipt = $this->ReadReceipt; + if (\strlen($sReadReceipt) && !\in_array('$forwarded', $aFlags)) { + try + { + if (!\MailSo\Mime\Email::Parse($sReadReceipt)) { + $sReadReceipt = ''; + } + } + catch (\Throwable $oException) + { + $sReadReceipt = ''; + } + } + $result = array( '@Object' => 'Object/Message', 'folder' => $this->sFolder, @@ -520,7 +520,8 @@ class Message implements \JsonSerializable 'isSpam' => $this->bIsSpam, 'hasVirus' => $this->bHasVirus, // 'virusScanned' => $this->sVirusScanned, - 'dateTimeStampInUTC' => $this->iInternalTimeStampInUTC, + 'dateTimestamp' => $this->iHeaderTimeStampInUTC ?: $this->iInternalTimeStampInUTC, + 'internalTimestamp' => $this->iInternalTimeStampInUTC, // \MailSo\Mime\EmailCollection 'from' => $this->oFrom, @@ -532,8 +533,7 @@ class Message implements \JsonSerializable 'deliveredTo' => $this->oDeliveredTo, 'priority' => $this->iPriority, - 'unsubsribeLinks' => $this->UnsubsribeLinks, - 'readReceipt' => '', + 'readReceipt' => $sReadReceipt, 'autocrypt' => $aAutocrypt ?: null, 'attachments' => $this->Attachments, @@ -542,7 +542,7 @@ class Message implements \JsonSerializable 'dkim' => $this->DKIM, 'dmarc' => $this->DMARC, - 'flags' => $this->getFlags(), + 'flags' => $aFlags, 'inReplyTo' => $this->InReplyTo, @@ -555,6 +555,27 @@ class Message implements \JsonSerializable 'size' => $this->iSize ); + if ($this->DraftInfo) { + $result['draftInfo'] = $this->DraftInfo; + } + if ($this->UnsubsribeLinks) { + $result['unsubsribeLinks'] = $this->UnsubsribeLinks; + } + if ($this->References) { + $result['references'] = $this->References; + } + if ($this->sHtml || $this->sPlain) { + $result['html'] = $this->sHtml; + $result['plain'] = $this->sPlain; + } +// $this->GetCapa(Capa::OPEN_PGP) || $this->GetCapa(Capa::GNUPG) + if ($this->pgpSigned) { + $result['pgpSigned'] = $this->pgpSigned; + } + if ($this->pgpEncrypted) { + $result['pgpEncrypted'] = $this->pgpEncrypted; + } + if ($this->aThreads) { $result['threads'] = $this->aThreads; } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php index e0559c41f..567e64112 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Response.php @@ -93,47 +93,13 @@ trait Response if ($mResponse instanceof \MailSo\Mail\Message) { $aResult = $mResponse->jsonSerialize(); - - if (!$aResult['dateTimeStampInUTC'] || $this->Config()->Get('labs', 'date_from_headers', true)) { - $iDateTimeStampInUTC = $mResponse->HeaderTimeStampInUTC; - if ($iDateTimeStampInUTC) { - $aResult['dateTimeStampInUTC'] = $iDateTimeStampInUTC; - } + if (!$this->Config()->Get('labs', 'date_from_headers', true) && $aResult['internalTimestamp']) { + $aResult['dateTimestamp'] = $aResult['internalTimestamp']; } - - if (!$sParent) { + if (!$sParent && \strlen($aResult['readReceipt']) && !\in_array('$forwarded', $aResult['flags'])) { $oAccount = $this->getAccountFromToken(); - - $aResult['draftInfo'] = $mResponse->DraftInfo; - $aResult['unsubsribeLinks'] = $mResponse->UnsubsribeLinks; - $aResult['references'] = $mResponse->References; - - $aResult['html'] = $mResponse->Html(); - $aResult['plain'] = $mResponse->Plain(); - -// $this->GetCapa(Capa::OPEN_PGP) || $this->GetCapa(Capa::GNUPG) - $aResult['pgpSigned'] = $mResponse->pgpSigned; - $aResult['pgpEncrypted'] = $mResponse->pgpEncrypted; - - $aResult['readReceipt'] = $mResponse->ReadReceipt; - if (\strlen($aResult['readReceipt']) && !\in_array('$forwarded', $aResult['flags'])) { - // \in_array('$mdnsent', $aResult['flags']) - if (\strlen($aResult['readReceipt'])) { - try - { - $oReadReceipt = \MailSo\Mime\Email::Parse($aResult['readReceipt']); - if (!$oReadReceipt) { - $aResult['readReceipt'] = ''; - } - } - catch (\Throwable $oException) { unset($oException); } - } - - if (\strlen($aResult['readReceipt']) && '1' === $this->Cacher($oAccount)->Get( - \RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $aResult['folder'], $aResult['uid']), '0')) - { - $aResult['readReceipt'] = ''; - } + if ('1' === $this->Cacher($oAccount)->Get(\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $aResult['folder'], $aResult['uid']), '0')) { + $aResult['readReceipt'] = ''; } } return $aResult; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/AbstractConfig.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/AbstractConfig.php index 483c165db..86630a601 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/AbstractConfig.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/AbstractConfig.php @@ -2,7 +2,7 @@ namespace RainLoop\Config; -abstract class AbstractConfig implements \JsonSerializable +abstract class AbstractConfig implements \ArrayAccess, \JsonSerializable { private string $sFile; @@ -33,6 +33,23 @@ abstract class AbstractConfig implements \JsonSerializable \MailSo\Base\Utils::FunctionsCallable(array('apcu_fetch', 'apcu_store')); } + public function offsetExists($offset) : bool + { + } + public function offsetGet($offset) + { + $offset = \explode('/', $offset, 2); + $this->Get($offset[0], $offset[1]); + } + public function offsetSet($offset, $value) : void + { + $offset = \explode('/', $offset, 2); + $this->Set($offset[0], $offset[1], $value); + } + public function offsetUnset($offset) : void + { + } + protected abstract function defaultValues() : array; public function IsInited() : bool diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html index b49b95dd1..473835439 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageList.html @@ -141,7 +141,7 @@
- + @@ -161,7 +161,7 @@ - + diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html index 5326857d0..bd45573ac 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -155,12 +155,12 @@