Changeset c26b398 in github


Ignore:
Timestamp:
Nov 5, 2010 8:19:12 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
c0ed783
Parents:
9be483c
Message:
  • Fix mailbox status checking when skip_deleted and threading are enabled
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap.php

    r30b3022 rc26b398  
    548548 
    549549        if ($mode == 'THREADS') { 
    550             $count = $this->_threadcount($mailbox, $msg_count); 
     550            $res   = $this->_threadcount($mailbox, $msg_count); 
     551            $count = $res['count']; 
     552 
    551553            if ($status) { 
    552                 $this->set_folder_stats($mailbox, 'cnt', $msg_count); 
    553                 $this->set_folder_stats($mailbox, 'maxuid', $msg_count ? $this->_id2uid($msg_count, $mailbox) : 0); 
     554                $this->set_folder_stats($mailbox, 'cnt', $res['msgcount']); 
     555                $this->set_folder_stats($mailbox, 'maxuid', $res['maxuid'] ? $this->_id2uid($res['maxuid'], $mailbox) : 0); 
    554556            } 
    555557        } 
     
    619621     * 
    620622     * @param string $mailbox   Folder name 
    621      * @param int    $msg_count Number of messages in the folder 
     623     * 
     624     * @returns array Array containing items: 'count' - threads count, 
     625     *                'msgcount' = messages count, 'maxuid' = max. UID in the set 
    622626     * @access  private 
    623      * @see     rcube_imap::messagecount() 
    624      */ 
    625     private function _threadcount($mailbox, &$msg_count) 
    626     { 
     627     */ 
     628    private function _threadcount($mailbox) 
     629    { 
     630        $result = array(); 
     631 
    627632        if (!empty($this->icache['threads'])) { 
    628             $msg_count = count($this->icache['threads']['depth']); 
    629             return count($this->icache['threads']['tree']); 
    630         } 
    631  
    632         if (is_array($result = $this->_fetch_threads($mailbox))) { 
    633             $thread_tree = array_shift($result); 
    634             $msg_count = count($result[0]); 
    635         } 
    636  
     633            $result = array( 
     634                'count'    => count($this->icache['threads']['tree']), 
     635                'msgcount' => count($this->icache['threads']['depth']), 
     636                'maxuid'   => max(array_keys($this->icache['threads']['depth'])), 
     637            ); 
     638        } 
     639        else if (is_array($result = $this->_fetch_threads($mailbox))) { 
    637640//        list ($thread_tree, $msg_depth, $has_children) = $result; 
    638641//        $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children); 
    639         return count($thread_tree); 
     642            $result = array( 
     643                'count'    => count($result[0]), 
     644                'msgcount' => count($result[1]), 
     645                'maxuid'   => max(array_keys($result[1])), 
     646            ); 
     647        } 
     648 
     649        return $result; 
    640650    } 
    641651 
Note: See TracChangeset for help on using the changeset viewer.