From c2b8e27eabfdbb7801c463a34423f7691ebafc0d Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 23 Nov 2009 20:11:52 -0700 Subject: [PATCH] Use LIST-EXTENDED functions to get subscribed list. --- imp/docs/RFCS | 1 + imp/lib/Imap/Tree.php | 15 +++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/imp/docs/RFCS b/imp/docs/RFCS index bcae5aa04..d83e6089f 100644 --- a/imp/docs/RFCS +++ b/imp/docs/RFCS @@ -42,6 +42,7 @@ RFC 5162 QRESYNC RFC 5182 SEARCHRES RFC 5255 LANGUAGE/I18NLEVEL RFC 5256 THREAD/SORT +RFC 5258 LIST-EXTENDED RFC 5267 ESORT RFC 5464 METADATA RFC 5550 Lemonade Profile (specifically [2.8] - $Forwarded flag) diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index 54641fed0..ceed6b5be 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -288,16 +288,8 @@ class IMP_Imap_Tree { if ($showunsub && !is_null($this->_fulllist)) { return array_keys($this->_fulllist); - } elseif (!$showunsub) { - if (is_null($this->_subscribed)) { - /* The subscribed list MAY contain mailboxes that do not - * currently exist on the server. See RFC 3501 [6.3.9]. So - * we need to grab the list of existing mailboxes using LIST - * and intersect against the LSUB list. */ - $this->_getList(true); - } else { - return array_keys($this->_subscribed); - } + } elseif (!$showunsub && !is_null($this->_subscribed)) { + return array_keys($this->_subscribed); } /* INBOX must always appear. */ @@ -305,14 +297,13 @@ class IMP_Imap_Tree foreach ($this->_namespaces as $key => $val) { try { - $names = array_merge($names, $GLOBALS['imp_imap']->ob()->listMailboxes($key . '*', $showunsub ? Horde_Imap_Client::MBOX_ALL : Horde_Imap_Client::MBOX_SUBSCRIBED, array('flat' => true))); + $names = array_merge($names, $GLOBALS['imp_imap']->ob()->listMailboxes($key . '*', $showunsub ? Horde_Imap_Client::MBOX_ALL : Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, array('flat' => true))); } catch (Horde_Imap_Client_Exception $e) {} } if ($showunsub) { $this->_fulllist = array_flip($names); } else { - $names = array_intersect($names, array_keys($this->_fulllist)); $this->_subscribed = array_flip($names); } -- 2.11.0