summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_imap.php4
-rw-r--r--program/lib/Roundcube/rcube_result_multifolder.php11
2 files changed, 15 insertions, 0 deletions
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 23cacd4d2..a2f610a0a 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -988,6 +988,10 @@ class rcube_imap extends rcube_storage
$a_msg_headers = array_slice(array_values($a_msg_headers), $from, $slice_length);
}
else {
+ if ($this->sort_order != $search_set->get_parameters('ORDER')) {
+ $search_set->revert();
+ }
+
// slice resultset first...
$fetch = array();
foreach (array_slice($search_set->get(), $from, $slice_length) as $msg_id) {
diff --git a/program/lib/Roundcube/rcube_result_multifolder.php b/program/lib/Roundcube/rcube_result_multifolder.php
index 74a3d7805..b5473b841 100644
--- a/program/lib/Roundcube/rcube_result_multifolder.php
+++ b/program/lib/Roundcube/rcube_result_multifolder.php
@@ -130,6 +130,17 @@ class rcube_result_multifolder
public function revert()
{
$this->order = $this->order == 'ASC' ? 'DESC' : 'ASC';
+ $this->index = array();
+
+ // revert order in all sub-sets
+ foreach ($this->sets as $set) {
+ if ($this->order != $set->get_parameters('ORDER')) {
+ $set->revert();
+ }
+ $folder = $set->get_parameters('MAILBOX');
+ $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $set->get());
+ $this->index = array_merge($this->index, $index);
+ }
}