Logic modification

This commit is contained in:
Lewis Cowles 2015-05-24 12:19:25 +01:00
parent d52ceb17ec
commit 470cc114b0

View File

@ -323,13 +323,13 @@ class Server
*/
public function numMessages($mailbox='')
{
$mboxExists = $this->hasMailbox($mailbox);
$oldMailbox = $this->getMailBox();
$mboxExists = ($this->hasMailbox($mailbox) && $oldMailbox != $mailbox);
if ($mboxExists){
$oldMailbox = $this->getMailBox();
$this->setMailbox($mailbox);
}
$cnt = imap_num_msg($this->getImapStream());
if ( $mboxExists ){
if ($mboxExists){
$this->setMailbox($oldMailbox);
}
return ((!$mboxExists && $mailbox !== '') ? 0 : $cnt);