From: Gunnar Wrobel
Date: Fri, 6 Nov 2009 09:12:53 +0000 (+0100) Subject: Hotfixes to get the Kolab storage driver to work with the new Imap_Client library. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9a598efb7a049256f2f2a45cb82d4f8a74886b16;p=horde.git Hotfixes to get the Kolab storage driver to work with the new Imap_Client library. --- diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage.php index 6d8666945..b7ee91ff1 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage.php @@ -12,11 +12,6 @@ */ /** - * The Autoloader allows us to omit "require/include" statements. - */ -require_once 'Horde/Autoloader.php'; - -/** * The Horde_Kolab_Storage class provides the means to access the * Kolab server storage for groupware objects. * diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Data.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Data.php index 287a88175..d43c4edc6 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Data.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Data.php @@ -477,11 +477,14 @@ class Horde_Kolab_Storage_Data } /* Log the action on this item in the history log. */ - $history = &Horde_History::singleton(); + try { + $history = &Horde_History::singleton(); - $history_id = $app . ':' . $this->_folder->getShareId() . ':' . $object_uid; - $history->log($history_id, array('action' => $action, 'ts' => $mod_ts), - true); + $history_id = $app . ':' . $this->_folder->getShareId() . ':' . $object_uid; + $history->log($history_id, array('action' => $action, 'ts' => $mod_ts), + true); + } catch (Horde_Exception $e) { + } } diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Imap.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Imap.php index 3b74f52b3..cb62408b0 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Imap.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Imap.php @@ -47,6 +47,7 @@ class Horde_Kolab_Storage_Driver_Imap extends Horde_Kolab_Storage_Driver } else { $driver = 'socket'; } + $this->_imap = Horde_Imap_Client::factory($driver, $params); } @@ -57,7 +58,7 @@ class Horde_Kolab_Storage_Driver_Imap extends Horde_Kolab_Storage_Driver */ public function getMailboxes() { - return $this->_imap->listMailboxes('', Horde_Imap_Client::MBOX_ALL, array('flat' => true)); + return $this->_imap->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array('flat' => true)); } /** @@ -229,9 +230,14 @@ class Horde_Kolab_Storage_Driver_Imap extends Horde_Kolab_Storage_Driver function getMessageHeader($mailbox, $uid, $peek_for_body = true) { $options = array('ids' => array($uid)); - $criteria = array(Horde_Imap_Client::FETCH_HEADERTEXT => array()); - $result = $this->_imap->fetch($mailbox, $criteria, $options); - return $result['headertext'][$uid]; + $criteria = array( + Horde_Imap_Client::FETCH_HEADERTEXT => array( + array( + ) + ) + ); + $result = $this->_imap->fetch($mailbox, $criteria, $options); + return $result[$uid]['headertext'][0]; } /** @@ -246,9 +252,14 @@ class Horde_Kolab_Storage_Driver_Imap extends Horde_Kolab_Storage_Driver function getMessageBody($mailbox, $uid) { $options = array('ids' => array($uid)); - $criteria = array(Horde_Imap_Client::FETCH_BODYTEXT => array()); + $criteria = array( + Horde_Imap_Client::FETCH_BODYTEXT => array( + array( + ) + ) + ); $result = $this->_imap->fetch($mailbox, $criteria, $options); - return $result['bodytext'][$uid]; + return $result[$uid]['bodytext'][0]; } /** @@ -295,7 +306,7 @@ class Horde_Kolab_Storage_Driver_Imap extends Horde_Kolab_Storage_Driver function getAnnotation($entry, $mailbox_name) { $result = $this->_imap->getMetadata($mailbox_name, $entry); - return $result[$entry]; + return $result[$mailbox_name][$entry]; } /** diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder.php index 9ee53c498..cdf6c2723 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder.php @@ -33,18 +33,18 @@ class Horde_Kolab_Storage_Folder * The root of the Kolab annotation hierarchy, used on the various IMAP * folder that are used by Kolab clients. */ - const ANNOT_ROOT = '/vendor/kolab/'; + const ANNOT_ROOT = '/shared/vendor/kolab/'; /** * The annotation, as defined by the Kolab format spec, that is used to store * information about what groupware format the folder contains. */ - const ANNOT_FOLDER_TYPE = '/vendor/kolab/folder-type'; + const ANNOT_FOLDER_TYPE = '/shared/vendor/kolab/folder-type'; /** * Horde-specific annotations on the imap folder have this prefix. */ - const ANNOT_SHARE_ATTR = '/vendor/horde/share-'; + const ANNOT_SHARE_ATTR = '/shared/vendor/horde/share-'; /** * Kolab specific free/busy relevance @@ -351,7 +351,7 @@ class Horde_Kolab_Storage_Folder try { $this->_connection->create($this->name); $this->_connection->setAnnotation(self::ANNOT_FOLDER_TYPE, - array('value.shared' => $this->_type), + $this->_type, $this->name); $this->trigger($this->name); $this->_connection->delete($this->name); @@ -592,7 +592,7 @@ class Horde_Kolab_Storage_Folder if ($attribute == 'desc') { $entry = '/comment'; } else { - $entry = HORDE_ANNOT_SHARE_ATTR . $attribute; + $entry = self::ANNOT_SHARE_ATTR . $attribute; } $annotation = $this->_getAnnotation($entry, $this->name); if (is_a($annotation, 'PEAR_Error')) { @@ -964,7 +964,7 @@ class Horde_Kolab_Storage_Folder } } - $session = &Horde_Kolab_Session::singleton(); + $session = &Horde_Kolab_Session_Singleton::singleton(); // Update email headers $new_headers->addHeader('From', $session->user_mail); @@ -1146,7 +1146,7 @@ class Horde_Kolab_Storage_Folder switch($type) { case 'event': - $session = &Horde_Kolab_Session::singleton(); + $session = &Horde_Kolab_Session_Singleton::singleton(); $url = sprintf('%s/trigger/%s/%s.pfb', $session->freebusy_server, $owner, $subpath); break;