mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
This change should make MessageListByRequestIndexOrUids faster
This commit is contained in:
parent
9b25b8580c
commit
e3fd72571c
2 changed files with 10 additions and 6 deletions
|
|
@ -55,6 +55,11 @@ class SequenceSet /*extends \SplFixedArray*/ implements \Countable
|
|||
return \array_search($value, $this->data);
|
||||
}
|
||||
|
||||
public function getArrayCopy(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$aResult = array();
|
||||
|
|
|
|||
|
|
@ -781,16 +781,15 @@ class MailClient
|
|||
|
||||
if (\count($aFetchResponse))
|
||||
{
|
||||
$aCollection = [];
|
||||
$aCollection = \array_fill_keys($oRange->getArrayCopy(), null);
|
||||
$sFetchType = $oRange->UID ? \MailSo\Imap\Enumerations\FetchType::UID : \MailSo\Imap\Enumerations\FetchType::INDEX;
|
||||
foreach ($aFetchResponse as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) {
|
||||
$i = $oRange->indexOf($oFetchResponseItem->GetFetchValue($sFetchType));
|
||||
if (false !== $i) {
|
||||
$aCollection[$i] = Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem);
|
||||
$id = $oFetchResponseItem->GetFetchValue($sFetchType);
|
||||
if (\array_key_exists($id, $aCollection)) {
|
||||
$aCollection[$id] = Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem);
|
||||
}
|
||||
}
|
||||
\ksort($aCollection);
|
||||
$oMessageCollection->exchangeArray(\array_values($aCollection));
|
||||
$oMessageCollection->exchangeArray(\array_values(\array_filter($aCollection)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue