mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
Bugfix: MessageListByRequestIndexOrUids() sort order failed due to new SequenceSet
This commit is contained in:
parent
55160a5152
commit
9b25b8580c
2 changed files with 15 additions and 9 deletions
|
|
@ -31,9 +31,9 @@ class SequenceSet /*extends \SplFixedArray*/ implements \Countable
|
|||
public function __construct($mItems, bool $uid = true)
|
||||
{
|
||||
if (\is_array($mItems)) {
|
||||
$this->data = $uid ? \array_filter(\array_map(function($id){
|
||||
$this->data = \array_values($uid ? \array_filter(\array_map(function($id){
|
||||
return \preg_match('/^([0-9]+|\\*):([0-9]+|\\*)/', $id, $dummy) ? $id : \intval($id);
|
||||
}, $mItems)) : $mItems;
|
||||
}, $mItems)) : $mItems);
|
||||
} else if (\is_scalar($mItems)) {
|
||||
$this->data[] = $mItems;
|
||||
}
|
||||
|
|
@ -50,6 +50,11 @@ class SequenceSet /*extends \SplFixedArray*/ implements \Countable
|
|||
return \in_array($value, $this->data);
|
||||
}
|
||||
|
||||
public function indexOf($value)/*: int|false*/
|
||||
{
|
||||
return \array_search($value, $this->data);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$aResult = array();
|
||||
|
|
|
|||
|
|
@ -781,15 +781,16 @@ class MailClient
|
|||
|
||||
if (\count($aFetchResponse))
|
||||
{
|
||||
$aCollection = [];
|
||||
$sFetchType = $oRange->UID ? \MailSo\Imap\Enumerations\FetchType::UID : \MailSo\Imap\Enumerations\FetchType::INDEX;
|
||||
foreach ($aFetchResponse as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem)
|
||||
{
|
||||
if ($oRange->contains($oFetchResponseItem->GetFetchValue($sFetchType))) {
|
||||
$oMessageCollection->append(
|
||||
Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem)
|
||||
);
|
||||
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);
|
||||
}
|
||||
}
|
||||
\ksort($aCollection);
|
||||
$oMessageCollection->exchangeArray(\array_values($aCollection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -927,7 +928,7 @@ class MailClient
|
|||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
*/
|
||||
public function MessageList(\MailSo\Mail\MessageListParams $oParams) : MessageCollection
|
||||
public function MessageList(MessageListParams $oParams) : MessageCollection
|
||||
{
|
||||
if (!\MailSo\Base\Validator::RangeInt($oParams->iOffset, 0) ||
|
||||
!\MailSo\Base\Validator::RangeInt($oParams->iLimit, 0, 999))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue