mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
More changes for #1003
This commit is contained in:
parent
8c7fd77762
commit
206c8abdf5
2 changed files with 29 additions and 17 deletions
|
|
@ -465,6 +465,29 @@ class Message implements \JsonSerializable
|
||||||
return $oMessage;
|
return $oMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ETag(string $sClientHash) : string
|
||||||
|
{
|
||||||
|
return \md5('MessageHash/' . \implode('/', [
|
||||||
|
$this->sFolder,
|
||||||
|
$this->Uid,
|
||||||
|
\implode(',', $this->getFlags()),
|
||||||
|
// \implode(',', $this->aThreads),
|
||||||
|
$sClientHash
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://datatracker.ietf.org/doc/html/rfc5788#section-3.4.1
|
||||||
|
// Thunderbird $label1 is same as $Important?
|
||||||
|
// Thunderbird $label4 is same as $todo?
|
||||||
|
protected function getFlags() : array
|
||||||
|
{
|
||||||
|
return \array_unique(\str_replace(
|
||||||
|
['$readreceipt', '$replied', /* 'junk', 'nonjunk', '$queued', '$sent', 'sent'*/],
|
||||||
|
['$mdnsent', '\\answered',/* '$junk', '$notjunk', '$submitpending', '$submitted', '$submitted'*/],
|
||||||
|
$this->aFlagsLowerCase
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[\ReturnTypeWillChange]
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
|
|
@ -476,15 +499,6 @@ class Message implements \JsonSerializable
|
||||||
$this->aFlagsLowerCase
|
$this->aFlagsLowerCase
|
||||||
), true);
|
), true);
|
||||||
*/
|
*/
|
||||||
// https://datatracker.ietf.org/doc/html/rfc5788#section-3.4.1
|
|
||||||
// Thunderbird $label1 is same as $Important?
|
|
||||||
// Thunderbird $label4 is same as $todo?
|
|
||||||
$aFlags = \array_unique(\str_replace(
|
|
||||||
['$readreceipt', '$replied', /* 'junk', 'nonjunk', '$queued', '$sent', 'sent'*/],
|
|
||||||
['$mdnsent', '\\answered',/* '$junk', '$notjunk', '$submitpending', '$submitted', '$submitted'*/],
|
|
||||||
$this->aFlagsLowerCase
|
|
||||||
));
|
|
||||||
|
|
||||||
$aAutocrypt = [];
|
$aAutocrypt = [];
|
||||||
if ($this->sAutocrypt) {
|
if ($this->sAutocrypt) {
|
||||||
foreach (\explode(';', $this->sAutocrypt) as $entry) {
|
foreach (\explode(';', $this->sAutocrypt) as $entry) {
|
||||||
|
|
@ -527,7 +541,7 @@ class Message implements \JsonSerializable
|
||||||
'dkim' => $this->DKIM,
|
'dkim' => $this->DKIM,
|
||||||
'dmarc' => $this->DMARC,
|
'dmarc' => $this->DMARC,
|
||||||
|
|
||||||
'flags' => $aFlags,
|
'flags' => $this->getFlags(),
|
||||||
|
|
||||||
'inReplyTo' => $this->InReplyTo,
|
'inReplyTo' => $this->InReplyTo,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -406,15 +406,12 @@ trait Messages
|
||||||
{
|
{
|
||||||
$sRawKey = (string) $this->GetActionParam('RawKey', '');
|
$sRawKey = (string) $this->GetActionParam('RawKey', '');
|
||||||
|
|
||||||
$sFolder = '';
|
|
||||||
$iUid = 0;
|
|
||||||
|
|
||||||
$aValues = \json_decode(\MailSo\Base\Utils::UrlSafeBase64Decode($sRawKey), true);
|
$aValues = \json_decode(\MailSo\Base\Utils::UrlSafeBase64Decode($sRawKey), true);
|
||||||
if ($aValues && 2 <= \count($aValues)) {
|
if ($aValues && 2 <= \count($aValues)) {
|
||||||
$sFolder = (string) $aValues[0];
|
$sFolder = (string) $aValues[0];
|
||||||
$iUid = (int) $aValues[1];
|
$iUid = (int) $aValues[1];
|
||||||
|
// $useThreads = !empty($aValues[2]);
|
||||||
$this->verifyCacheByKey($sRawKey);
|
// $accountHash = $aValues[3];
|
||||||
} else {
|
} else {
|
||||||
$sFolder = $this->GetActionParam('folder', '');
|
$sFolder = $this->GetActionParam('folder', '');
|
||||||
$iUid = (int) $this->GetActionParam('uid', 0);
|
$iUid = (int) $this->GetActionParam('uid', 0);
|
||||||
|
|
@ -432,9 +429,10 @@ trait Messages
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oMessage) {
|
if ($oMessage) {
|
||||||
|
$ETag = $oMessage->ETag($this->ImapClient()->Hash());
|
||||||
|
$this->verifyCacheByKey($ETag);
|
||||||
$this->Plugins()->RunHook('filter.result-message', array($oMessage));
|
$this->Plugins()->RunHook('filter.result-message', array($oMessage));
|
||||||
|
$this->cacheByKey($ETag);
|
||||||
$this->cacheByKey($sRawKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->DefaultResponse($oMessage);
|
return $this->DefaultResponse($oMessage);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue