From fdc2d5a490d30019fad021e07d7ab8c63bf796cc Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 25 Mar 2024 01:43:22 +0100 Subject: [PATCH] Attempt to solve #1507 --- .../v/0.0.0/app/libraries/MailSo/Mail/MailClient.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index b628f8a43..7969e91d6 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -750,9 +750,7 @@ class MailClient $oAllParams = clone $oParams; $oAllParams->sSearch = ''; $oAllParams->oSequenceSet = null; - if ($message_list_limit && $message_list_limit < $oInfo->MESSAGES && !$oParams->iThreadUid - && $oParams->oCacher && $oParams->oCacher->IsInited() - ) { + if ($message_list_limit && !$oParams->iThreadUid && $oParams->oCacher && $oParams->oCacher->IsInited()) { $aUids = $this->GetUids($oAllParams, $oInfo, true); if ($aUids) { $message_list_limit = 0; @@ -768,9 +766,8 @@ class MailClient } } - if ($message_list_limit && $message_list_limit < $oInfo->MESSAGES && !$aUids) { -// if ((0 < $message_list_limit && $message_list_limit < $oInfo->MESSAGES) -// || (!$this->oImapClient->hasCapability('SORT') && !$this->oImapClient->CapabilityValue('THREAD'))) { + if ($message_list_limit && !$aUids) { +// if ($message_list_limit || (!$this->oImapClient->hasCapability('SORT') && !$this->oImapClient->CapabilityValue('THREAD'))) { // Don't use THREAD for speed $oMessageCollection->Limited = true; $this->logWrite('List optimization (count: '.$oInfo->MESSAGES.', limit:'.$message_list_limit.')'); @@ -823,7 +820,7 @@ class MailClient // Remove all threaded UID's except the most recent of each thread $threadedUids = []; foreach ($aAllThreads as $aMap) { - unset($aMap[\array_key_last($aMap)]); + unset($aMap[\array_search(\max($aMap), $aMap)]); $threadedUids = \array_merge($threadedUids, $aMap); } $aUids = \array_diff($aUids, $threadedUids);