From ccbbc410c6ea7294162616dc0d1005c022ceaced Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 21 Mar 2009 23:28:46 +0000 Subject: So it seems that commits efdff41, cbc33bd, and 8f612c3 were all for naught and the problem may in fact be a bug with Dovecot. I have asked on the Dovecot mailist. Meantime, this is a workaround. --- roundcubemail/program/include/rcube_imap.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index e5abe8a5f..c89a4ff4a 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -587,7 +587,7 @@ class rcube_imap $message_threading = $this->get_capability('thread=references') && rcmail::get_instance()->imap->threading; - $max = $this->_messagecount($mailbox, rcmail::get_instance()->config->get('imap_thread_algorithm'), 'ALL'); + $max = $this->_messagecount($mailbox, ($message_threading) ? 'THREADS' : 'ALL'); list($begin, $end) = $this->_get_message_range($max, $page); @@ -622,6 +622,12 @@ class rcube_imap } else { list ($thread_tree, $msg_depth, $has_children) = iil_C_Thread($this->conn, $mailbox, rcmail::get_instance()->config->get('imap_thread_algorithm'), 'ALL'); } + + // Temporary fix for a possible bug in Dovecot X-REFERENCES2. + // Remove this if/when the bug is fixed or the problem solved. + if ($thread_tree && array_key_exists(0,$thread_tree)) + unset($thread_tree[0]); + $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children); // the keys of thread_tree are the thread roots $roots = array_keys($thread_tree); @@ -696,8 +702,6 @@ class rcube_imap $deleted_count = $this->_fetch_headers($mailbox, $msgs, $a_msg_headers, $cache_key); // delete cached messages with a higher index than $max+1 // Changed $max to $max+1 to fix this bug : #1484295 - if ($message_threading) - $max = $this->_messagecount($mailbox, 'ALL'); $this->clear_message_cache($cache_key, $max + 1); } -- cgit v1.2.3