summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube_imap.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-22 08:46:10 +0200
committerAleksander Machniak <alec@alec.pl>2013-06-22 08:46:10 +0200
commitf255dd787c62b4910a5794ff1379cad80781e311 (patch)
treee7be5d9c07e52fc61a99d275135867daa847e228 /program/lib/Roundcube/rcube_imap.php
parent39a82a5d458fe86f735c14959c97b1c7aa2a5a7d (diff)
Fix error when searching in threaded mode
Diffstat (limited to 'program/lib/Roundcube/rcube_imap.php')
-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;
}