mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +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);
|
return \array_search($value, $this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getArrayCopy(): array
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
$aResult = array();
|
$aResult = array();
|
||||||
|
|
|
||||||
|
|
@ -781,16 +781,15 @@ class MailClient
|
||||||
|
|
||||||
if (\count($aFetchResponse))
|
if (\count($aFetchResponse))
|
||||||
{
|
{
|
||||||
$aCollection = [];
|
$aCollection = \array_fill_keys($oRange->getArrayCopy(), null);
|
||||||
$sFetchType = $oRange->UID ? \MailSo\Imap\Enumerations\FetchType::UID : \MailSo\Imap\Enumerations\FetchType::INDEX;
|
$sFetchType = $oRange->UID ? \MailSo\Imap\Enumerations\FetchType::UID : \MailSo\Imap\Enumerations\FetchType::INDEX;
|
||||||
foreach ($aFetchResponse as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) {
|
foreach ($aFetchResponse as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) {
|
||||||
$i = $oRange->indexOf($oFetchResponseItem->GetFetchValue($sFetchType));
|
$id = $oFetchResponseItem->GetFetchValue($sFetchType);
|
||||||
if (false !== $i) {
|
if (\array_key_exists($id, $aCollection)) {
|
||||||
$aCollection[$i] = Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem);
|
$aCollection[$id] = Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\ksort($aCollection);
|
$oMessageCollection->exchangeArray(\array_values(\array_filter($aCollection)));
|
||||||
$oMessageCollection->exchangeArray(\array_values($aCollection));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue