From f255dd787c62b4910a5794ff1379cad80781e311 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sat, 22 Jun 2013 02:46:10 -0400 Subject: [PATCH] Fix error when searching in threaded mode --- program/lib/Roundcube/rcube_imap.php | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index d65f6af..5a80779 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -1206,29 +1206,33 @@ // we have a saved search result, get index from there if ($this->search_string) { - if ($this->search_threads) { - $this->search($folder, $this->search_string, $this->search_charset, $this->sort_field); - } - - // use message index sort as default sorting - if (!$this->sort_field || $this->search_sorted) { - if ($this->sort_field && $this->search_sort_field != $this->sort_field) { - $this->search($folder, $this->search_string, $this->search_charset, $this->sort_field); - } - $index = $this->search_set; - } - else if (!$this->check_connection()) { + if ($this->search_set->is_empty()) { return new rcube_result_index(); } + + // disable threading temporarily + $threading = $this->threading; + $this->threading = false; + + if ($this->search_threads) { + $index = $this->search_index($folder, $this->search_string, $this->search_charset, $this->sort_field); + } + else if ((!$this->sort_field && !$this->search_sorted) || + ($this->search_sorted && $this->search_sort_field == $this->sort_field) + ) { + $index = $this->search_set; + } else { - $index = $this->conn->index($folder, $this->search_set->get(), - $this->sort_field, $this->options['skip_deleted'], true, true); + $search = 'UID ' . $this->search_set->get_compressed(); + $index = $this->search_index($folder, $search, $this->search_charset, $this->sort_field); } if ($this->sort_order != $index->get_parameters('ORDER')) { $index->revert(); } + $this->threading = $threading; + return $index; } -- Gitblit v1.9.1