From 470cc114b0d237cb99961d539ac87fac264d06d7 Mon Sep 17 00:00:00 2001 From: Lewis Cowles Date: Sun, 24 May 2015 12:19:25 +0100 Subject: [PATCH] Logic modification --- src/Fetch/Server.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Fetch/Server.php b/src/Fetch/Server.php index 6700b98..7c4bb44 100644 --- a/src/Fetch/Server.php +++ b/src/Fetch/Server.php @@ -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);