summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-04-23 14:53:29 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-04-23 14:53:29 +0200
commitab366809d5df50f9e5c88e1ab3671318d296ccb3 (patch)
tree9b62af68dfae3ec2f4605500d16bcf615ad841c9 /program
parent6f9bb11bb1b695439a99b9969b6c46a7379c0534 (diff)
Only refresh the affected parts of a cross-folder search set after moving/deleting/flagging
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_imap.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 2038b94d8..4204354b3 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1714,6 +1714,19 @@ class rcube_imap extends rcube_storage
return $this->get_search_set();
}
+ /**
+ * Flag certain result subsets as 'incomplete'.
+ * For subsequent refresh_search() calls to only refresh the updated parts.
+ */
+ protected function set_search_dirty($folder)
+ {
+ if ($this->search_set && is_a($this->search_set, 'rcube_result_multifolder')) {
+ if ($subset = $this->search_set->get_set($folder)) {
+ $subset->incomplete = $this->search_set->incomplete = true;
+ }
+ }
+ }
+
/**
* Return message headers object of a specific message
@@ -2420,6 +2433,8 @@ class rcube_imap extends rcube_storage
$this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids));
}
}
+
+ $this->set_search_dirty($folder);
}
return $result;
@@ -2529,6 +2544,9 @@ class rcube_imap extends rcube_storage
if ($moved) {
$this->clear_messagecount($from_mbox);
$this->clear_messagecount($to_mbox);
+
+ $this->set_search_dirty($from_mbox);
+ $this->set_search_dirty($to_mbox);
}
// moving failed
else if ($to_trash && $config->get('delete_always', false)) {
@@ -2545,7 +2563,7 @@ class rcube_imap extends rcube_storage
if ($this->search_threads || $all_mode) {
$this->refresh_search();
}
- else {
+ else if (!$this->search_set->incomplete) {
$this->search_set->filter(explode(',', $uids), $this->folder);
}
}
@@ -2633,13 +2651,15 @@ class rcube_imap extends rcube_storage
// unset threads internal cache
unset($this->icache['threads']);
+ $this->set_search_dirty($folder);
+
// remove message ids from search set
if ($this->search_set && $folder == $this->folder) {
// threads are too complicated to just remove messages from set
if ($this->search_threads || $all_mode) {
$this->refresh_search();
}
- else {
+ else if (!$this->search_set->incomplete) {
$this->search_set->filter(explode(',', $uids));
}
}