roundcubemail/program/lib/Roundcube/rcube_imap_generic.php
public function countUnseen($mailbox)
    {
        // Check internal cache
        $cache = $this->data['STATUS:'.$mailbox];
        if (!empty($cache) && isset($cache['UNSEEN'])) {
            return (int) $cache['UNSEEN'];
        }

        // Try STATUS (should be faster than SELECT+SEARCH)
        $counts = $this->status($mailbox);
        if (is_array($counts)) {
            return (int) $counts['UNSEEN'];
        }

        // Invoke SEARCH as a fallback
        $index = $this->search($mailbox, 'ALL UNSEEN', false, array('COUNT'));
        if (!$index->is_error()) {
            return $index->count();
        }

        return false;
    }
public function countUnseen($mailbox)
    {
        // Check internal cache
        $cache = $this->data['STATUS:'.$mailbox];
        if (!empty($cache) && isset($cache['UNSEEN'])) {
            return (int) $cache['UNSEEN'];
        }

        // Try STATUS (should be faster than SELECT+SEARCH)
        $counts = $this->status($mailbox);
        if (is_array($counts)) {
            return (int) $counts['UNSEEN'];
        }

        // Invoke SEARCH as a fallback
        $index = $this->search($mailbox, 'ALL UNSEEN', false, array('COUNT'));
        if (!$index->is_error()) {
            return $index->count();
        }

        return false;
    }
public function countUnseen ( $ mailbox ) { // Check internal cache $ cache = $ this -> data [ 'STATUS:' . $ mailbox ] ; if ( ! empty ( $ cache ) && isset ( $ cache [ 'UNSEEN' ] ) ) { return ( int ) $ cache [ 'UNSEEN' ] ; } // Try STATUS (should be faster than SELECT+SEARCH) $ counts = $ this -> status ( $ mailbox ) ; if ( is_array ( $ counts ) ) { return ( int ) $ counts [ 'UNSEEN' ] ; } // Invoke SEARCH as a fallback $ index = $ this -> search ( $ mailbox , 'ALL UNSEEN' , false , array ( 'COUNT' ) ) ; if ( ! $ index -> is_error ( ) ) { return $ index -> count ( ) ; } return false ; }
Returns count of messages without \Seen flag in a specified folder

@param string $mailbox Mailbox name

@return int Number of messages, False on error
Returns count of messages without \ Seen flag in a specified folder