Use the new namespace handler (Bug #6691).
authorGunnar Wrobel <p@rdus.de>
Tue, 23 Mar 2010 06:48:51 +0000 (07:48 +0100)
committerGunnar Wrobel <wrobel@temple.(none)>
Tue, 23 Mar 2010 06:53:34 +0000 (07:53 +0100)
framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Imap.php

index 7e9892e..929993a 100644 (file)
@@ -45,15 +45,4 @@ abstract class Horde_Kolab_Storage_Driver
         throw new Horde_Kolab_Storage_Exception(
             'Driver type definition "' . $class . '" missing.');
     }
-
-    /**
-     * Retrieve the namespace information for this connection.
-     *
-     * @return Horde_Kolab_Storage_Namespace The initialized namespace handler.
-     */
-    public function getNamespace()
-    {
-        return new Horde_Kolab_Storage_Namespace_Fixed();
-    }
-
 }
\ No newline at end of file
index bd05be3..f7f1a0c 100644 (file)
@@ -335,4 +335,25 @@ class Horde_Kolab_Storage_Driver_Imap extends Horde_Kolab_Storage_Driver
         return $this->_imap->setMetadata($mailbox_name,
                                          array($entry => $value));
     }
+
+
+    /**
+     * Retrieve the namespace information for this connection.
+     *
+     * @return Horde_Kolab_Storage_Namespace The initialized namespace handler.
+     */
+    public function getNamespace()
+    {
+        if ($this->_imap->queryCapability('NAMESPACE') === true) {
+            return new Horde_Kolab_Storage_Namespace_Imap(
+                $this->_imap->getNamespaces(),
+                isset($this->_params['namespaces']) ? $this->_params['namespaces'] : array()
+            );
+        } else if (isset($this->_params['namespaces'])) {
+            return new Horde_Kolab_Storage_Namespace_Config(
+                $this->_params['namespaces']
+            );
+        }
+        return new Horde_Kolab_Storage_Namespace_Fixed();
+    }
 }
\ No newline at end of file