Copyright 2009-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Gunnar Wrobel (wrobel@pardus.de)
Inheritance: implements Horde_Kolab_Storage_Driver
Exemple #1
0
 /**
  * Constructor.
  *
  * @param Horde_Kolab_Storage_Factory $factory A factory for helper objects.
  * @param array $params                        Connection parameters.
  */
 public function __construct(Horde_Kolab_Storage_Factory $factory, $params = array())
 {
     if (isset($params['data'])) {
         if (is_array($params['data'])) {
             $params['data'] = new Horde_Kolab_Storage_Driver_Mock_Data($params['data']);
         }
         $this->_data = $params['data'];
         unset($params['data']);
     } else {
         $this->_data = new Horde_Kolab_Storage_Driver_Mock_Data(array());
     }
     parent::__construct($factory, $params);
 }
Exemple #2
0
 /**
  * Retrieve the namespace information for this connection.
  *
  * @return Horde_Kolab_Storage_Driver_Namespace The initialized namespace handler.
  */
 public function getNamespace()
 {
     if ($this->getBackend()->getCapability('NAMESPACE') === true) {
         $namespaces = array();
         foreach ($this->getBackend()->getNamespace() as $type => $elements) {
             if (is_array($elements)) {
                 foreach ($elements as $namespace) {
                     $namespace['name'] = $namespace[0];
                     $namespace['delimiter'] = $namespace[1];
                     $namespace['type'] = $type;
                     $namespaces[] = $namespace;
                 }
             }
         }
         $this->_namespace = $this->getFactory()->createNamespace('imap', $this->getAuth(), $namespaces);
     }
     return parent::getNamespace();
 }
Exemple #3
0
 /**
  * Retrieve the namespace information for this connection.
  *
  * @return Horde_Kolab_Storage_Driver_Namespace The initialized namespace handler.
  */
 public function getNamespace()
 {
     if ($this->getBackend()->hasCapability('NAMESPACE') === true) {
         $namespaces = array();
         foreach ($this->getBackend()->getNamespace() as $type => $elements) {
             foreach ($elements as $namespace) {
                 switch ($type) {
                     case 'others':
                         $namespace['type'] = 'other';
                         break;
                     default:
                         $namespace['type'] = $type;
                         break;
                 }
                 $namespace['delimiter'] = $namespace['delimter'];
                 $namespaces[] = $namespace;
             }
         }
         return new Horde_Kolab_Storage_Folder_Namespace_Imap($this->getAuth(), $namespaces, $this->getParam('namespaces', array()));
     }
     return parent::getNamespace();
 }
Exemple #4
0
 /**
  * Retrieve the namespace information for this connection.
  *
  * @return Horde_Kolab_Storage_Driver_Namespace The initialized namespace handler.
  */
 public function getNamespace()
 {
     if ($this->_namespace !== null) {
         return parent::getNamespace();
     }
     try {
         $this->getBackend()->login();
         if ($this->getBackend()->queryCapability('NAMESPACE') === true) {
             $c = array();
             $configuration = $this->getParam('namespaces', array());
             foreach ($this->getBackend()->getNamespaces() as $namespace) {
                 if (in_array($namespace['name'], array_keys($configuration))) {
                     $namespace = array_merge($namespace, $configuration[$namespace['name']]);
                 }
                 switch ($namespace['type']) {
                     case Horde_Imap_Client::NS_PERSONAL:
                         $namespace['type'] = Horde_Kolab_Storage_Folder_Namespace::PERSONAL;
                         break;
                     case Horde_Imap_Client::NS_OTHER:
                         $namespace['type'] = Horde_Kolab_Storage_Folder_Namespace::OTHER;
                         break;
                     case Horde_Imap_Client::NS_SHARED:
                         $namespace['type'] = Horde_Kolab_Storage_Folder_Namespace::SHARED;
                         break;
                 }
                 $c[] = $namespace;
             }
             $this->_namespace = $this->getFactory()->createNamespace('imap', $this->getAuth(), $c);
         }
     } catch (Horde_Imap_Client_Exception_ServerResponse $e) {
         throw new Horde_Kolab_Storage_Exception($e->details);
     } catch (Horde_Imap_Client_Exception $e) {
         throw new Horde_Kolab_Storage_Exception($e);
     }
     return parent::getNamespace();
 }