public function listMailboxes( $reference = '', $mailbox = '*' )
    {
        if ( $this->state != self::STATE_AUTHENTICATED &&
             $this->state != self::STATE_SELECTED &&
             $this->state != self::STATE_SELECTED_READONLY )
        {
            throw new ezcMailTransportException( "Can't call listMailboxes() when not successfully logged in." );
        }

        $result = array();
        $tag = $this->getNextTag();
        $this->connection->sendData( "{$tag} LIST \"{$reference}\" \"{$mailbox}\"" );
        $response = trim( $this->connection->getLine() );
        while ( strpos( $response, '* LIST (' ) !== false )
        {
            // only consider the selectable mailboxes
            if ( strpos( $response, "\\Noselect" ) === false )
            {
                $response = substr( $response, strpos( $response, "\" " ) + 2 );
                $response = trim( $response );
                $response = trim( $response, "\"" );
                $result[] = $response;

            }
            $response = $this->connection->getLine();
        }

        $response = $this->getResponse( $tag, $response );
        if ( $this->responseType( $response ) != self::RESPONSE_OK )
        {
            throw new ezcMailTransportException( "Could not list mailboxes with the parameters '\"{$reference}\"' and '\"{$mailbox}\"': {$response}." );
        }
        return $result;
    }
public function listMailboxes( $reference = '', $mailbox = '*' )
    {
        if ( $this->state != self::STATE_AUTHENTICATED &&
             $this->state != self::STATE_SELECTED &&
             $this->state != self::STATE_SELECTED_READONLY )
        {
            throw new ezcMailTransportException( "Can't call listMailboxes() when not successfully logged in." );
        }

        $result = array();
        $tag = $this->getNextTag();
        $this->connection->sendData( "{$tag} LIST \"{$reference}\" \"{$mailbox}\"" );
        $response = trim( $this->connection->getLine() );
        while ( strpos( $response, '* LIST (' ) !== false )
        {
            // only consider the selectable mailboxes
            if ( strpos( $response, "\\Noselect" ) === false )
            {
                $response = substr( $response, strpos( $response, "\" " ) + 2 );
                $response = trim( $response );
                $response = trim( $response, "\"" );
                $result[] = $response;

            }
            $response = $this->connection->getLine();
        }

        $response = $this->getResponse( $tag, $response );
        if ( $this->responseType( $response ) != self::RESPONSE_OK )
        {
            throw new ezcMailTransportException( "Could not list mailboxes with the parameters '\"{$reference}\"' and '\"{$mailbox}\"': {$response}." );
        }
        return $result;
    }
public function listMailboxes ( $ reference = '' , $ mailbox = '*' ) { if ( $ this -> state != self :: STATE_AUTHENTICATED && $ this -> state != self :: STATE_SELECTED && $ this -> state != self :: STATE_SELECTED_READONLY ) { throw new ezcMailTransportException ( "Can't call listMailboxes() when not successfully logged in." ) ; } $ result = array ( ) ; $ tag = $ this -> getNextTag ( ) ; $ this -> connection -> sendData ( "{$tag} LIST \"{$reference}\" \"{$mailbox}\"" ) ; $ response = trim ( $ this -> connection -> getLine ( ) ) ; while ( strpos ( $ response , '* LIST (' ) !== false ) { // only consider the selectable mailboxes if ( strpos ( $ response , "\\Noselect" ) === false ) { $ response = substr ( $ response , strpos ( $ response , "\" " ) + 2 ) ; $ response = trim ( $ response ) ; $ response = trim ( $ response , "\"" ) ; $ result [ ] = $ response ; } $ response = $ this -> connection -> getLine ( ) ; } $ response = $ this -> getResponse ( $ tag , $ response ) ; if ( $ this -> responseType ( $ response ) != self :: RESPONSE_OK ) { throw new ezcMailTransportException ( "Could not list mailboxes with the parameters '\"{$reference}\"' and '\"{$mailbox}\"': {$response}." ) ; } return $ result ; }
Returns an array with the names of the available mailboxes for the user
currently authenticated on the IMAP server.

Before calling this method, a connection to the IMAP server must be
established and a user must be authenticated successfully.

For more information about $reference and $mailbox, consult
the IMAP RFCs documents ({@link http://www.faqs.org/rfcs/rfc1730.html}
or {@link http://www.faqs.org/rfcs/rfc2060.html}, section 7.2.2.).

By default, $reference is "" and $mailbox is "*".

The array returned contains the mailboxes available for the connected
user on this IMAP server. Inbox is a special mailbox, and it can be
specified upper-case or lower-case or mixed-case. The other mailboxes
should be specified as they are (to the {@link selectMailbox()} method).

Example of listing mailboxes:
<code>
$imap = new ezcMailImapTransport( 'imap.example.com' );
$imap->authenticate( 'username', 'password' );

$mailboxes = $imap->listMailboxes();
</code>

@throws ezcMailMailTransportException
if the current server state is not accepted
or if the server sent a negative response
@param string $reference
@param string $mailbox
@return array(string)
Returns an array with the names of the available mailboxes for the user currently authenticated on the IMAP server .