summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/Roundcube/rcube_imap.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index d65f6afab..5a80779cd 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1206,29 +1206,33 @@ class rcube_imap extends rcube_storage
// 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);
+ if ($this->search_set->is_empty()) {
+ return new rcube_result_index();
}
- // 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;
+ // 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->check_connection()) {
- return new rcube_result_index();
+ 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;
}