Git rid of IMP_Imap_Tree::FLIST_ELT mask option
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 17 Aug 2010 18:11:29 +0000 (12:11 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 17 Aug 2010 18:11:29 +0000 (12:11 -0600)
imp/folders-mimp.php
imp/folders.php
imp/lib/Ajax/Application.php
imp/lib/Block/tree_folders.php
imp/lib/Folder.php
imp/lib/Imap/Tree.php
imp/search.php

index 7a94e75..0047624 100644 (file)
@@ -33,7 +33,7 @@ $showAll = (!$subscribe || $_SESSION['imp']['showunsub']);
 
 /* Initialize the IMP_Imap_Tree object. */
 $imptree = $injector->getInstance('IMP_Imap_Tree');
-$mask = IMP_Imap_Tree::FLIST_ELT;
+$mask = 0;
 
 /* Toggle subscribed view, if necessary. */
 if ($subscribe && Horde_Util::getFormData('ts')) {
index 1166704..fd75a9a 100644 (file)
@@ -359,7 +359,6 @@ if ($_SESSION['imp']['file_upload'] && ($actionID == 'import_mbox')) {
 /* Build the folder tree. */
 $mask = IMP_Imap_Tree::FLIST_CONTAINER |
     IMP_Imap_Tree::FLIST_VFOLDER |
-    IMP_Imap_Tree::FLIST_ELT |
     IMP_Imap_Tree::FLIST_EXPANDED;
 $raw_rows = $imaptree->folderList($mask);
 
index 89a7691..95502a3 100644 (file)
@@ -285,7 +285,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $initreload = ($this->_vars->initial || $this->_vars->reload);
         $result = new stdClass;
 
-        $mask = IMP_Imap_Tree::FLIST_CONTAINER | IMP_Imap_Tree::FLIST_VFOLDER | IMP_Imap_Tree::FLIST_ELT;
+        $mask = IMP_Imap_Tree::FLIST_CONTAINER | IMP_Imap_Tree::FLIST_VFOLDER;
         if ($this->_vars->unsub) {
             $mask |= IMP_Imap_Tree::FLIST_UNSUB;
         }
index cdc8ebe..6b896aa 100644 (file)
@@ -68,8 +68,7 @@ class Horde_Block_imp_tree_folders extends Horde_Block
         /* Initialize the IMP_Tree object. */
         $imaptree = $injector->getInstance('IMP_Imap_Tree');
         $mask = IMP_Imap_Tree::FLIST_CONTAINER |
-            IMP_Imap_Tree::FLIST_VFOLDER |
-            IMP_Imap_Tree::FLIST_ELT;
+            IMP_Imap_Tree::FLIST_VFOLDER;
 
         $unseen = 0;
         $inbox = null;
index dc46270..786b6e6 100644 (file)
@@ -102,8 +102,7 @@ class IMP_Folder
         }
 
         $imaptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree');
-
-        $list_mask = IMP_Imap_Tree::FLIST_CONTAINER | IMP_Imap_Tree::FLIST_ELT;
+        $list_mask = IMP_Imap_Tree::FLIST_CONTAINER;
         if (!$sub) {
             $list_mask |= IMP_Imap_Tree::FLIST_UNSUB;
         }
@@ -326,7 +325,7 @@ class IMP_Folder
         $imaptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree');
 
         /* Get list of any folders that are underneath this one. */
-        $all_folders = array_merge(array($old), $imaptree->folderList(IMP_Imap_Tree::FLIST_UNSUB, $old));
+        $all_folders = array_merge(array($old), array_keys($imaptree->folderList(IMP_Imap_Tree::FLIST_UNSUB, $old)));
 
         try {
             $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->renameMailbox($old, $new);
index d66e207..b3d983c 100644 (file)
@@ -51,11 +51,10 @@ class IMP_Imap_Tree
     const FLIST_CONTAINER = 1;
     const FLIST_UNSUB = 2;
     const FLIST_VFOLDER = 4;
-    const FLIST_ELT = 8;
-    const FLIST_NOCHILDREN = 16;
-    const FLIST_ANCESTORS = 32;
-    const FLIST_SAMELEVEL = 64;
-    const FLIST_EXPANDED = 128;
+    const FLIST_NOCHILDREN = 8;
+    const FLIST_ANCESTORS = 16;
+    const FLIST_SAMELEVEL = 32;
+    const FLIST_EXPANDED = 64;
 
     /* Add null to folder key since it allows us to sort by name but
      * never conflict with an IMAP mailbox. */
@@ -1573,19 +1572,16 @@ class IMP_Imap_Tree
      * IMP_Imap_Tree::FLIST_CONTAINER - Show container elements.
      * IMP_Imap_Tree::FLIST_UNSUB - Show unsubscribed elements.
      * IMP_Imap_Tree::FLIST_VFOLDER - Show Virtual Folders.
-     * IMP_Imap_Tree::FLIST_ELT - Return IMP_Imap_Tree_Element object.
      * IMP_Imap_Tree::FLIST_NOCHILDREN - Don't show child elements.
      * IMP_Imap_Tree::FLIST_ANCESTORS - Include ancestors.
      * IMP_Imap_Tree::FLIST_SAMELEVEL - Also return mailboxes at the same
      *                                  level as $base.
      * IMP_Imap_Tree::FLIST_EXPANDED - Only included expanded folders.
      * </pre>
-     * </pre>
      * @param string $base  Return all mailboxes below this element.
      *
-     * @return array  Either an array of IMAP mailbox names or an array of
-     *                IMP_Imap_Tree_Elt elements (if FLIST_ELT is specified).
-     *                Keys are the mailbox name.
+     * @return array  Keys are mailbox name, values are IMP_Imap_Tree_Element
+     *                objects.
      */
     public function folderList($mask = 0, $base = null)
     {
@@ -1647,9 +1643,7 @@ class IMP_Imap_Tree
                      !$this->isContainer($mailbox)) &&
                     (($mask & self::FLIST_VFOLDER) ||
                      !$this->isVFolder($mailbox))) {
-                    $ret_array[$mailbox['v']] = ($mask & self::FLIST_ELT)
-                        ? $this->element($mailbox)
-                        : $mailbox['v'];
+                    $ret_array[$mailbox['v']] = $this->element($mailbox);
                 }
             } while (($mailbox = $this->next($nextmask)));
         }
@@ -1663,7 +1657,6 @@ class IMP_Imap_Tree
             : $ret_array;
     }
 
-
     /**
      * Return the list of 'special' mailboxes.
      *
index 808e90a..fa1c4c6 100644 (file)
@@ -91,7 +91,7 @@ if (!empty($criteria)) {
 
 /* Generate master folder list. */
 $imp_imap_tree = $injector->getInstance('IMP_Imap_Tree');
-$mask = IMP_Imap_Tree::FLIST_CONTAINER | IMP_Imap_Tree::FLIST_ELT;
+$mask = IMP_Imap_Tree::FLIST_CONTAINER;
 
 $subscribe = $prefs->getValue('subscribe');
 if (!$subscribe || Horde_Util::getFormData('show_unsub')) {