#24707 [Opn->Csd]: Net_IMAP::getMailboxes()

From: Date: Sun, 20 Jul 2003 13:21:22 +0000
Subject: #24707 [Opn->Csd]: Net_IMAP::getMailboxes()
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18459@lists.php.net to get a copy of this message
ID: 24707 Updated by: damian@php.net Reported By: developer at heino dot gehlsen dot dk -Status: Open +Status: Closed Bug Type: PEAR related Operating System: Debian PHP Version: Irrelevant New Comment: Commited, But changed default. (Now it retrive all mailboxes by default) Previous Comments: ------------------------------------------------------------------------ [2003-07-18 07:39:39] developer at heino dot gehlsen dot dk Description: ------------ The getMailboxes('malibox', false) matches any mailbox, that either starts or ends with 'mailbox' = ("*/mailbox" || "mailbox/*"). The function should “… return only the mailbox that contains that exact name”... While resolving the problem, I took the liberty to alter the code, so it is also possible to retrieve only the immediate submailboxes. I changed the second (boolean) parameter into an integer, so a third option was available without making problems with backward compatibility… While at is, I also added the ability to use a string as the second parameter, so it is possible to use the same function for those of us, at prefer to handle the reference/mailbox stuff manually… ======================================== 831,832c831,832 < * @param string $mailbox_base base mailbox to start the search < * $mailbox_base if $mailbox_base == '' then $mailbox_base is the curent selected mailbox --- > * @param string $reference base mailbox to start the search > * $reference if $reference == '' then $reference is the curent selected mailbox 842c842 < function getMailboxes($mailbox_base = '' , $restriction_search = true, $returnAttributes=false ) --- > function getMailboxes($reference = '' , $restriction_search = 1, $returnAttributes=false ) 844a845,865 > if ( is_bool($restriction_search)) > $restriction_search = (int) $restriction_search; > > if (is_int($restriction_search)){ > switch ($restriction_search) { > case 0: > $mailbox = "*"; > break; > case 1: > $mailbox = $reference; > $reference = '%'; > break; > case 2: > $mailbox = "%"; > break; > } > } elseif (is_string($restriction_search)){ > $mailbox = $restriction_search; > } else { > return new PEAR_Error("UPS..."); > } 846,850c867 < if( $restriction_search ){ < $mailbox_base .="*"; < } < < if( PEAR::isError( $ret = $this->cmdList('*',$mailbox_base) ) ){ --- > if( PEAR::isError( $ret = $this->cmdList($reference, $mailbox) ) ){ ======================================== ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24707&edit=1

« previous php.pear.dev (#18459) next »