summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_imap.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-23 09:40:47 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-23 09:40:47 +0000
commit9640dcc0b1416dbf3f5228bced54b07d821e9fc1 (patch)
treef56b3f591f7f4060ebc8fa1a97c562b79e220482 /roundcubemail/program/include/rcube_imap.php
parentda35f6ba22ccf1c0feefe9653e345f2d6dcb8312 (diff)
- Set maxuid in threads mode, to prevent unnecessary list reloading on (first) check_recent
git-svn-id: https://svn.roundcube.net/trunk@3401 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
-rw-r--r--roundcubemail/program/include/rcube_imap.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php
index d0b29082b..26646f07f 100644
--- a/roundcubemail/program/include/rcube_imap.php
+++ b/roundcubemail/program/include/rcube_imap.php
@@ -532,16 +532,16 @@ class rcube_imap
if (!is_array($a_mailbox_cache[$mailbox]))
$a_mailbox_cache[$mailbox] = array();
- if ($mode == 'THREADS')
- $count = $this->_threadcount($mailbox);
-
+ if ($mode == 'THREADS') {
+ $count = $this->_threadcount($mailbox, $msg_count);
+ $_SESSION['maxuid'][$mailbox] = $msg_count ? $this->_id2uid($msg_count) : 0;
+ }
// RECENT count is fetched a bit different
- else if ($mode == 'RECENT')
+ else if ($mode == 'RECENT') {
$count = iil_C_CheckForRecent($this->conn, $mailbox);
-
+ }
// use SEARCH for message counting
- else if ($this->skip_deleted)
- {
+ else if ($this->skip_deleted) {
$search_str = "ALL UNDELETED";
// get message count and store in cache
@@ -585,12 +585,14 @@ class rcube_imap
* @access private
* @see rcube_imap::messagecount()
*/
- private function _threadcount($mailbox)
+ private function _threadcount($mailbox, &$msg_count)
{
if (!empty($this->icache['threads']))
return count($this->icache['threads']['tree']);
list ($thread_tree, $msg_depth, $has_children) = $this->_fetch_threads($mailbox);
+
+ $msg_count = count($msg_depth);
// $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children);
return count($thread_tree);