Move appendNamespace() to IMP_Imap::.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 5 Aug 2009 03:39:02 +0000 (21:39 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 5 Aug 2009 03:39:02 +0000 (21:39 -0600)
imp/folders.php
imp/lib/Api.php
imp/lib/IMP.php
imp/lib/Imap.php
imp/rss.php

index c6dad36..ea39570 100644 (file)
@@ -194,7 +194,7 @@ case 'rename_folder':
         !empty($old_names) &&
         ($iMax == count($old_names))) {
         for ($i = 0; $i < $iMax; ++$i) {
-            $imp_folder->rename(trim($old_names[$i], "\r\n"), Horde_String::convertCharset(IMP::appendNamespace(trim($new_names[$i], "\r\n")), $charset, 'UTF7-IMAP'));
+            $imp_folder->rename(trim($old_names[$i], "\r\n"), Horde_String::convertCharset($imp_imap->appendNamespace(trim($new_names[$i], "\r\n")), $charset, 'UTF7-IMAP'));
         }
     }
     break;
index b3bc34b..0b050e4 100644 (file)
@@ -506,9 +506,9 @@ class IMP_Api extends Horde_Registry_Api
         $sent_mail_default = $GLOBALS['prefs']->getValue('sent_mail_folder');
 
         if (empty($sent_mail_folder) && !empty($sent_mail_new)) {
-            $sent_mail_folder = IMP::appendNamespace($sent_mail_new);
+            $sent_mail_folder = $GLOBALS['imp_imap']->appendNamespace($sent_mail_new);
         } elseif (($sent_mail_folder == '-1') && !empty($sent_mail_default)) {
-            $sent_mail_folder = IMP::appendNamespace($sent_mail_default);
+            $sent_mail_folder = $GLOBALS['imp_imap']->appendNamespace($sent_mail_default);
         }
 
         if (!empty($sent_mail_folder)) {
@@ -538,7 +538,7 @@ class IMP_Api extends Horde_Registry_Api
                 $GLOBALS['prefs']->setValue($pref, '');
             } else {
                 if (empty($folder) && !empty($new)) {
-                    $folder = IMP::appendNamespace($new);
+                    $folder = $GLOBALS['imp_imap']->appendNamespace($new);
                     $imp_folder = IMP_Folder::singleton();
                     if (!$imp_folder->create($folder, $GLOBALS['prefs']->getValue('subscribe'))) {
                         $folder = null;
@@ -967,7 +967,7 @@ class IMP_Api extends Horde_Registry_Api
         }
 
         $imp_folder = IMP_Folder::singleton();
-        return $imp_folder->create(IMP::appendNamespace($folder), $GLOBALS['prefs']->getValue('subscribe'));
+        return $imp_folder->create($GLOBALS['imp_imap']->appendNamespace($folder), $GLOBALS['prefs']->getValue('subscribe'));
     }
 
     /**
index 97372ab..189d0a3 100644 (file)
@@ -884,23 +884,6 @@ class IMP
     }
 
     /**
-     * Make sure a user-entered mailbox contains namespace information.
-     *
-     * @param string $mbox  The user-entered mailbox string.
-     *
-     * @return string  The mailbox string with any necessary namespace info
-     *                 added.
-     */
-    static public function appendNamespace($mbox)
-    {
-        $ns_info = $GLOBALS['imp_imap']->getNamespace($mbox, false);
-        if (is_null($ns_info)) {
-            $ns_info = $GLOBALS['imp_imap']->defaultNamespace();
-        }
-        return $ns_info['name'] . $mbox;
-    }
-
-    /**
      * Generates a URL with necessary mailbox/UID information.
      *
      * @param string $page      Page name to link to.
index 1a2cbef..f85d6dc 100644 (file)
@@ -388,4 +388,22 @@ class IMP_Imap
 
         return $this->_nsdefault;
     }
+
+    /**
+     * Make sure a user-entered mailbox contains namespace information.
+     *
+     * @param string $mbox  The user-entered mailbox string.
+     *
+     * @return string  The mailbox string with any necessary namespace info
+     *                 added.
+     */
+    static public function appendNamespace($mbox)
+    {
+        $ns_info = $this->getNamespace($mbox, false);
+        if (is_null($ns_info)) {
+            $ns_info = $this->defaultNamespace();
+        }
+        return $ns_info['name'] . $mbox;
+    }
+
 }
index d899b55..357ea59 100644 (file)
@@ -32,7 +32,7 @@ if (!empty($request)) {
     $request_parts = explode('/-/', $request);
     if (!empty($request_parts[0])) {
         $ns_info = $imp_imap->getNamespace();
-        $mailbox = IMP::appendNamespace(preg_replace('/\//', $ns_info['delimiter'], trim($request_parts[0], '/')));
+        $mailbox = $imp_imap->appendNamespace(preg_replace('/\//', $ns_info['delimiter'], trim($request_parts[0], '/')));
 
         /* Make sure mailbox exists or else exit immediately. */
         $imp_folder = IMP_Folder::singleton();