summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-09-20 11:55:59 +0000
committeralecpl <alec@alec.pl>2011-09-20 11:55:59 +0000
commit37d511ff380e34a015dcc09b79704b33e3cf06b3 (patch)
tree20700d36dd39bfa4b14a370c3656bbfdd1f9952f /program
parent3d247e85bef500e73331a3bb03e702e68cb7820d (diff)
- Fix cached indexes validation after removing messages when skip_deleted=true
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap_cache.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/program/include/rcube_imap_cache.php b/program/include/rcube_imap_cache.php
index d30438622..8ef5b71cb 100644
--- a/program/include/rcube_imap_cache.php
+++ b/program/include/rcube_imap_cache.php
@@ -813,9 +813,16 @@ class rcube_imap_cache
}
// Folder is empty but cache isn't
- if (empty($mbox_data['EXISTS']) && (!empty($index['seq']) || !empty($index['tree']))) {
- $this->clear($mailbox);
- $exists = false;
+ if (empty($mbox_data['EXISTS'])) {
+ if (!empty($index['seq']) || !empty($index['tree'])) {
+ $this->clear($mailbox);
+ $exists = false;
+ return false;
+ }
+ }
+ // Folder is not empty but cache is
+ else if (empty($index['seq']) && empty($index['tree'])) {
+ unset($this->icache[$mailbox][$is_thread ? 'thread' : 'index']);
return false;
}
@@ -880,7 +887,7 @@ class rcube_imap_cache
rcube_imap_generic::compressMessageSet($index['uid']));
if (!empty($ids)) {
- $index = null; // cache invalid
+ return false;
}
}
}
@@ -996,12 +1003,22 @@ class rcube_imap_cache
!empty($uids) ? $uids : '1:*', true, array('FLAGS'),
$index['modseq'], $qresync);
+ $invalidated = false;
+
if (!empty($result)) {
foreach ($result as $id => $msg) {
$uid = $msg->uid;
// Remove deleted message
if ($this->skip_deleted && !empty($msg->flags['DELETED'])) {
$this->remove_message($mailbox, $uid);
+
+ if (!$invalidated) {
+ $invalidated = true;
+ // Invalidate thread indexes (?)
+ $this->remove_thread($mailbox);
+ // Invalidate index
+ $index['valid'] = false;
+ }
continue;
}
@@ -1036,6 +1053,8 @@ class rcube_imap_cache
// Invalidate thread indexes (?)
$this->remove_thread($mailbox);
+ // Invalidate index
+ $index['valid'] = false;
}
}
}