Horde_Imap_Client_Socket::_listMailboxes PHP Method

_listMailboxes() protected method

protected _listMailboxes ( $pattern, $mode, $options )
    protected function _listMailboxes($pattern, $mode, $options)
    {
        // RFC 5258 [3.1]: Use LSUB for MBOX_SUBSCRIBED if no other server
        // return options are specified.
        if ($mode == Horde_Imap_Client::MBOX_SUBSCRIBED && !array_intersect(array_keys($options), array('attributes', 'children', 'recursivematch', 'remote', 'special_use', 'status'))) {
            return $this->_getMailboxList($pattern, Horde_Imap_Client::MBOX_SUBSCRIBED, array('flat' => !empty($options['flat']), 'no_listext' => true));
        }
        // Get the list of subscribed/unsubscribed mailboxes. Since LSUB is
        // not guaranteed to have correct attributes, we must use LIST to
        // ensure we receive the correct information.
        if ($mode != Horde_Imap_Client::MBOX_ALL && !$this->_capability('LIST-EXTENDED')) {
            $subscribed = $this->_getMailboxList($pattern, Horde_Imap_Client::MBOX_SUBSCRIBED, array('flat' => true));
            // If mode is subscribed, and 'flat' option is true, we can
            // return now.
            if ($mode == Horde_Imap_Client::MBOX_SUBSCRIBED && !empty($options['flat'])) {
                return $subscribed;
            }
        } else {
            $subscribed = null;
        }
        return $this->_getMailboxList($pattern, $mode, $options, $subscribed);
    }