Use LIST-EXTENDED functions to get subscribed list.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 24 Nov 2009 03:11:52 +0000 (20:11 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 24 Nov 2009 03:14:40 +0000 (20:14 -0700)
imp/docs/RFCS
imp/lib/Imap/Tree.php

index bcae5aa..d83e608 100644 (file)
@@ -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)
index 54641fe..ceed6b5 100644 (file)
@@ -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);
         }