diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-05 12:19:12 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-05 12:19:12 +0000 |
| commit | f2e45baec9b59298f21e8f4834f84636da9c1125 (patch) | |
| tree | 1d3f78f4cf335e7dcc0a1dc6dd7ebb469f07c53f /roundcubemail/program/include | |
| parent | 1b8f581739ce3fae2457708abd35621b6644b0cb (diff) | |
- Fix mailbox status checking when skip_deleted and threading are enabled
git-svn-id: https://svn.roundcube.net/trunk@4186 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 17ba91c03..aa6521af8 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -547,10 +547,12 @@ class rcube_imap $a_mailbox_cache[$mailbox] = array(); if ($mode == 'THREADS') { - $count = $this->_threadcount($mailbox, $msg_count); + $res = $this->_threadcount($mailbox, $msg_count); + $count = $res['count']; + if ($status) { - $this->set_folder_stats($mailbox, 'cnt', $msg_count); - $this->set_folder_stats($mailbox, 'maxuid', $msg_count ? $this->_id2uid($msg_count, $mailbox) : 0); + $this->set_folder_stats($mailbox, 'cnt', $res['msgcount']); + $this->set_folder_stats($mailbox, 'maxuid', $res['maxuid'] ? $this->_id2uid($res['maxuid'], $mailbox) : 0); } } // RECENT count is fetched a bit different @@ -618,25 +620,33 @@ class rcube_imap * Private method for getting nr of threads * * @param string $mailbox Folder name - * @param int $msg_count Number of messages in the folder + * + * @returns array Array containing items: 'count' - threads count, + * 'msgcount' = messages count, 'maxuid' = max. UID in the set * @access private - * @see rcube_imap::messagecount() */ - private function _threadcount($mailbox, &$msg_count) + private function _threadcount($mailbox) { - if (!empty($this->icache['threads'])) { - $msg_count = count($this->icache['threads']['depth']); - return count($this->icache['threads']['tree']); - } + $result = array(); - if (is_array($result = $this->_fetch_threads($mailbox))) { - $thread_tree = array_shift($result); - $msg_count = count($result[0]); + if (!empty($this->icache['threads'])) { + $result = array( + 'count' => count($this->icache['threads']['tree']), + 'msgcount' => count($this->icache['threads']['depth']), + 'maxuid' => max(array_keys($this->icache['threads']['depth'])), + ); } - + else if (is_array($result = $this->_fetch_threads($mailbox))) { // list ($thread_tree, $msg_depth, $has_children) = $result; // $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children); - return count($thread_tree); + $result = array( + 'count' => count($result[0]), + 'msgcount' => count($result[1]), + 'maxuid' => max(array_keys($result[1])), + ); + } + + return $result; } |
