From c60b5093ff62af2dc7f9489be60226a8e2baac38 Mon Sep 17 00:00:00 2001 From: Cristi Cotet Date: Thu, 21 Dec 2017 14:03:13 +0200 Subject: [PATCH 1/3] Fix switchMailbox --- src/PhpImap/Mailbox.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index bcdac6aa..53b6b3f6 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -123,7 +123,7 @@ public function getImapStream($forceConnection = true) { */ public function switchMailbox($imapPath) { $this->imapPath = $imapPath; - $this->imap('reopen', $this->imapPath,false); + $this->imap('reopen', $this->imapPath); } protected function initImapStreamWithRetry() { From e087dd6340f95a68a4447e998ef685898a2b71f5 Mon Sep 17 00:00:00 2001 From: Cristi Cotet Date: Thu, 21 Dec 2017 15:58:53 +0200 Subject: [PATCH 2/3] implement getSubscribedMailboxes / subscribeMailbox / unsubscribeMailbox --- src/PhpImap/Mailbox.php | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 53b6b3f6..32767b18 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -793,7 +793,41 @@ public function getMailboxes($search = "*") { } return $arr; } - + /** + * Get folders list + * @param string $search + * @return array + */ + public function getSubscribedMailboxes($search = "*") { + $arr = []; + if($t = imap_getsubscribed($this->getImapStream(), $this->imapPath, $search)) { + foreach($t as $item) { + $arr[] = [ + "fullpath" => $item->name, + "attributes" => $item->attributes, + "delimiter" => $item->delimiter, + "shortpath" => substr($item->name, strpos($item->name, '}') + 1), + ]; + } + } + return $arr; + } + + /** + * @param $mailbox + * @throws Exception + */ + public function subscribeMailbox($mailbox) { + $this->imap('subscribe', $this->imapPath . '.' . $mailbox); + } + + /** + * @param $mailbox + * @throws Exception + */ + public function unsubscribeMailbox($mailbox) { + $this->imap('unsubscribe', $this->imapPath . '.' . $mailbox); + } /** * Call IMAP extension function call wrapped with utf7 args conversion & errors handling * From c4878fbca57156abfea503f9bceb48429e6630b2 Mon Sep 17 00:00:00 2001 From: Cristi Cotet Date: Fri, 22 Dec 2017 11:58:04 +0200 Subject: [PATCH 3/3] convert spaces to tabs --- src/PhpImap/Mailbox.php | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 32767b18..736e0fc4 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -793,41 +793,41 @@ public function getMailboxes($search = "*") { } return $arr; } - /** - * Get folders list - * @param string $search - * @return array - */ - public function getSubscribedMailboxes($search = "*") { - $arr = []; - if($t = imap_getsubscribed($this->getImapStream(), $this->imapPath, $search)) { - foreach($t as $item) { - $arr[] = [ - "fullpath" => $item->name, - "attributes" => $item->attributes, - "delimiter" => $item->delimiter, - "shortpath" => substr($item->name, strpos($item->name, '}') + 1), - ]; - } - } - return $arr; - } - - /** - * @param $mailbox - * @throws Exception - */ - public function subscribeMailbox($mailbox) { - $this->imap('subscribe', $this->imapPath . '.' . $mailbox); - } - - /** - * @param $mailbox - * @throws Exception - */ - public function unsubscribeMailbox($mailbox) { - $this->imap('unsubscribe', $this->imapPath . '.' . $mailbox); - } + /** + * Get folders list + * @param string $search + * @return array + */ + public function getSubscribedMailboxes($search = "*") { + $arr = []; + if($t = imap_getsubscribed($this->getImapStream(), $this->imapPath, $search)) { + foreach($t as $item) { + $arr[] = [ + "fullpath" => $item->name, + "attributes" => $item->attributes, + "delimiter" => $item->delimiter, + "shortpath" => substr($item->name, strpos($item->name, '}') + 1), + ]; + } + } + return $arr; + } + + /** + * @param $mailbox + * @throws Exception + */ + public function subscribeMailbox($mailbox) { + $this->imap('subscribe', $this->imapPath . '.' . $mailbox); + } + + /** + * @param $mailbox + * @throws Exception + */ + public function unsubscribeMailbox($mailbox) { + $this->imap('unsubscribe', $this->imapPath . '.' . $mailbox); + } /** * Call IMAP extension function call wrapped with utf7 args conversion & errors handling *