mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Resolve #1716
This commit is contained in:
parent
a4299c5f1c
commit
56db74986f
1 changed files with 17 additions and 13 deletions
|
|
@ -553,11 +553,13 @@ class MailClient
|
||||||
$aSortUids = \array_reduce($aAllThreads, 'array_merge', []);
|
$aSortUids = \array_reduce($aAllThreads, 'array_merge', []);
|
||||||
$oParams->oSequenceSet = new \MailSo\Imap\SequenceSet($aSortUids);
|
$oParams->oSequenceSet = new \MailSo\Imap\SequenceSet($aSortUids);
|
||||||
$aSortUids = $this->GetUids($oParams, $oFolderInfo);
|
$aSortUids = $this->GetUids($oParams, $oFolderInfo);
|
||||||
foreach ($aAllThreads as $aThreadUIDs) {
|
if ($aSortUids) {
|
||||||
$aThreadUIDs = \array_intersect($aSortUids, $aThreadUIDs);
|
foreach ($aAllThreads as $aThreadUIDs) {
|
||||||
// Remove the most recent UID
|
$aThreadUIDs = \array_intersect($aSortUids, $aThreadUIDs);
|
||||||
\array_pop($aThreadUIDs);
|
// Remove the most recent UID
|
||||||
$aUids = \array_merge($aUids, $aThreadUIDs);
|
\array_pop($aThreadUIDs);
|
||||||
|
$aUids = \array_merge($aUids, $aThreadUIDs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -631,7 +633,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\*
|
* @throws \MailSo\Net\Exceptions\*
|
||||||
* @throws \MailSo\Imap\Exceptions\*
|
* @throws \MailSo\Imap\Exceptions\*
|
||||||
*/
|
*/
|
||||||
private function GetUids(MessageListParams $oParams, FolderInformation $oInfo, bool $onlyCache = false) : array
|
private function GetUids(MessageListParams $oParams, FolderInformation $oInfo, bool $onlyCache = false) : ?array
|
||||||
{
|
{
|
||||||
$oCacher = $oParams->oCacher;
|
$oCacher = $oParams->oCacher;
|
||||||
$sFolderName = $oParams->sFolderName;
|
$sFolderName = $oParams->sFolderName;
|
||||||
|
|
@ -691,7 +693,7 @@ class MailClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($onlyCache) {
|
if ($onlyCache) {
|
||||||
return [];
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->oImapClient->FolderExamine($sFolderName);
|
$this->oImapClient->FolderExamine($sFolderName);
|
||||||
|
|
@ -794,7 +796,7 @@ class MailClient
|
||||||
|
|
||||||
$aAllThreads = [];
|
$aAllThreads = [];
|
||||||
$aUnseenUIDs = [];
|
$aUnseenUIDs = [];
|
||||||
$aUids = [];
|
$aUids = null;
|
||||||
|
|
||||||
$message_list_limit = $this->oImapClient->Settings->message_list_limit;
|
$message_list_limit = $this->oImapClient->Settings->message_list_limit;
|
||||||
if (100 > $message_list_limit || $message_list_limit > $oInfo->MESSAGES) {
|
if (100 > $message_list_limit || $message_list_limit > $oInfo->MESSAGES) {
|
||||||
|
|
@ -807,7 +809,7 @@ class MailClient
|
||||||
$oAllParams->oSequenceSet = null;
|
$oAllParams->oSequenceSet = null;
|
||||||
if ($message_list_limit && !$oParams->iThreadUid && $oParams->oCacher && $oParams->oCacher->IsInited()) {
|
if ($message_list_limit && !$oParams->iThreadUid && $oParams->oCacher && $oParams->oCacher->IsInited()) {
|
||||||
$aUids = $this->GetUids($oAllParams, $oInfo, true);
|
$aUids = $this->GetUids($oAllParams, $oInfo, true);
|
||||||
if ($aUids) {
|
if (null !== $aUids) {
|
||||||
$message_list_limit = 0;
|
$message_list_limit = 0;
|
||||||
$oMessageCollection->Sort = $oAllParams->sSort;
|
$oMessageCollection->Sort = $oAllParams->sSort;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -898,10 +900,12 @@ class MailClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMessageCollection->totalEmails = \count($aUids);
|
if (\is_array($aUids)) {
|
||||||
if ($oMessageCollection->totalEmails) {
|
$oMessageCollection->totalEmails = \count($aUids);
|
||||||
$aUids = \array_slice($aUids, $oParams->iOffset, $oParams->iLimit);
|
if ($oMessageCollection->totalEmails) {
|
||||||
$this->MessageListByRequestIndexOrUids($oMessageCollection, new SequenceSet($aUids), $aAllThreads, $aUnseenUIDs);
|
$aUids = \array_slice($aUids, $oParams->iOffset, $oParams->iLimit);
|
||||||
|
$this->MessageListByRequestIndexOrUids($oMessageCollection, new SequenceSet($aUids), $aAllThreads, $aUnseenUIDs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oMessageCollection;
|
return $oMessageCollection;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue