--- /dev/null
+<?php
+/**
+ * The Horde_Kolab_Storage_Namespace_Config:: allows to configure the available
+ * IMAP namespaces on the Kolab server.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * The Horde_Kolab_Storage_Namespace_Config:: allows to configure the available
+ * IMAP namespaces on the Kolab server.
+ *
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_Namespace_Config
+extends Horde_Kolab_Storage_Namespace
+{
+ /**
+ * The namespaces.
+ *
+ * @var array
+ */
+ protected $_namespaces = array(
+ self::PRIV => array(
+ 'INBOX' => '/',
+ ),
+ self::OTHER => array(
+ 'user' => '/',
+ ),
+ self::SHARED => array(
+ '' => '/',
+ ),
+ );
+
+ /**
+ * A prefix in the shared namespaces that will be ignored/removed.
+ *
+ * @var string
+ */
+ protected $_sharedPrefix = '';
+
+ /**
+ * Indicates the personal namespace that the class will use to create new
+ * folders.
+ *
+ * @var string
+ */
+ protected $_primaryPersonalNamespace = 'INBOX';
+
+ /**
+ * Constructor.
+ */
+ public function __construct(array $configuration)
+ {
+ if (isset($configuration['elements'])) {
+ $this->_namespaces = $configuration['elements'];
+ }
+ if (isset($configuration['shared_prefix'])) {
+ $this->_sharedPrefix = $configuration['shared_prefix'];
+ }
+ if (isset($configuration['add_namespace'])) {
+ $this->_primaryPersonalNamespace = $configuration['add_namespace'];
+ }
+ $this->_charset = Horde_Nls::getCharset();
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * The Horde_Kolab_Storage_Namespace_Config:: allows to use the information from
+ * the IMAP NAMESPACE command to identify the IMAP namespaces on the Kolab
+ * server.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * The Horde_Kolab_Storage_Namespace_Config:: allows to use the information from
+ * the IMAP NAMESPACE command to identify the IMAP namespaces on the Kolab
+ * server.
+ *
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_Namespace_Imap
+extends Horde_Kolab_Storage_Namespace
+{
+ /**
+ * The namespaces.
+ *
+ * @var array
+ */
+ protected $_namespaces = array();
+
+ /**
+ * A prefix in the shared namespaces that will be ignored/removed.
+ *
+ * @var string
+ */
+ protected $_sharedPrefix = '';
+
+ /**
+ * Indicates the personal namespace that the class will use to create new
+ * folders.
+ *
+ * @var string
+ */
+ protected $_primaryPersonalNamespace = 'INBOX';
+
+ /**
+ * Constructor.
+ */
+ public function __construct(array $namespaces, array $configuration)
+ {
+ foreach ($namespaces as $namespace) {
+ $this->_namespaces[$namespace['type']][$namespace['name']] = $namespace['delimiter'];
+ }
+ if (isset($configuration['shared_prefix'])) {
+ $this->_sharedPrefix = $configuration['shared_prefix'];
+ }
+ if (isset($configuration['add_namespace'])) {
+ $this->_primaryPersonalNamespace = $configuration['add_namespace'];
+ }
+ $this->_charset = Horde_Nls::getCharset();
+ }
+}
\ No newline at end of file
<file name="Folder.php" role="php" />
<file name="Namespace.php" role="php" />
<dir name="Namespace">
+ <file name="Config.php" role="php" />
<file name="Fixed.php" role="php" />
+ <file name="Imap.php" role="php" />
</dir> <!-- /lib/Horde/Kolab/Storage/Namespace -->
<file name="Permission.php" role="php" />
</dir> <!-- /lib/Horde/Kolab/Storage -->
<install as="Horde/Kolab/Storage/Exception.php" name="lib/Horde/Kolab/Storage/Exception.php" />
<install as="Horde/Kolab/Storage/Folder.php" name="lib/Horde/Kolab/Storage/Folder.php" />
<install as="Horde/Kolab/Storage/Namespace.php" name="lib/Horde/Kolab/Storage/Namespace.php" />
+ <install as="Horde/Kolab/Storage/Namespace/Config.php" name="lib/Horde/Kolab/Storage/Namespace/Config.php" />
<install as="Horde/Kolab/Storage/Namespace/Fixed.php" name="lib/Horde/Kolab/Storage/Namespace/Fixed.php" />
+ <install as="Horde/Kolab/Storage/Namespace/Imap.php" name="lib/Horde/Kolab/Storage/Namespace/Imap.php" />
<install as="Horde/Kolab/Storage/Permission.php" name="lib/Horde/Kolab/Storage/Permission.php" />
<install as="Horde/Kolab/Storage/Driver/Imap.php" name="lib/Horde/Kolab/Storage/Driver/Imap.php" />
<install as="Horde/Kolab/Storage/AllTests.php" name="test/Horde/Kolab/Storage/AllTests.php" />
private function _getNamespaces()
{
return array(
- new Horde_Kolab_Storage_Namespace_Fixed()
+ new Horde_Kolab_Storage_Namespace_Fixed(),
+ new Horde_Kolab_Storage_Namespace_Config(
+ array(
+ 'elements' => array(
+ Horde_Kolab_Storage_Namespace::PRIV => array(
+ 'INBOX' => '/',
+ ),
+ Horde_Kolab_Storage_Namespace::OTHER => array(
+ 'user' => '/',
+ ),
+ Horde_Kolab_Storage_Namespace::SHARED => array(
+ '' => '/',
+ ),
+ ),
+ 'shared_prefix' => 'shared.',
+ 'add_namespace' => 'INBOX',
+ )
+ ),
+ new Horde_Kolab_Storage_Namespace_Imap(
+ array(
+ array(
+ 'name' => 'INBOX',
+ 'type' => Horde_Kolab_Storage_Namespace::PRIV,
+ 'delimiter' => '/',
+ ),
+ array(
+ 'name' => 'user',
+ 'type' => Horde_Kolab_Storage_Namespace::OTHER,
+ 'delimiter' => '/',
+ ),
+ array(
+ 'name' => '',
+ 'type' => Horde_Kolab_Storage_Namespace::SHARED,
+ 'delimiter' => '/',
+ ),
+ ),
+ array(
+ 'shared_prefix' => 'shared.',
+ 'add_namespace' => 'INBOX',
+ )
+ ),
+
);
}
}
\ No newline at end of file