summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <tb@woodcrest.local>2013-10-03 10:55:35 (GMT)
committerThomas <tb@woodcrest.local>2013-10-03 10:55:35 (GMT)
commitd21151a0b80debfede24beb4d32446b4f05e8b35 (patch)
treee084f3553b20b049fc8f97e14ea21f0831057a96
parentb8344ccf903e91cededfd03c8361811357c0d670 (diff)
downloadiRony-d21151a0b80debfede24beb4d32446b4f05e8b35.tar.gz
Use the UID getter and setter methods now provided by libkolab's kolab_storage_folder class
-rw-r--r--lib/Kolab/CalDAV/CalendarBackend.php2
-rw-r--r--lib/Kolab/CardDAV/ContactsBackend.php2
-rw-r--r--lib/Kolab/Utils/DAVBackend.php43
3 files changed, 4 insertions, 43 deletions
diff --git a/lib/Kolab/CalDAV/CalendarBackend.php b/lib/Kolab/CalDAV/CalendarBackend.php
index 510ddba..8ed1589 100644
--- a/lib/Kolab/CalDAV/CalendarBackend.php
+++ b/lib/Kolab/CalDAV/CalendarBackend.php
@@ -63,7 +63,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$this->calendars = $this->folders = $this->aliases = array();
foreach (kolab_storage::sort_folders($folders) as $folder) {
- $id = DAVBackend::get_uid($folder);
+ $id = $folder->get_uid();
$this->folders[$id] = $folder;
$fdata = $folder->get_imap_data(); // fetch IMAP folder data for CTag generation
$this->calendars[$id] = array(
diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php
index 414805a..bc29aca 100644
--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -59,7 +59,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
$this->sources = $this->folders = $this->aliases = array();
foreach (kolab_storage::sort_folders($folders) as $folder) {
- $id = DAVBackend::get_uid($folder);
+ $id = $folder->get_uid();
$fdata = $folder->get_imap_data(); // fetch IMAP folder data for CTag generation
$this->folders[$id] = $folder;
$this->sources[$id] = array(
diff --git a/lib/Kolab/Utils/DAVBackend.php b/lib/Kolab/Utils/DAVBackend.php
index 0734be9..27a4bcb 100644
--- a/lib/Kolab/Utils/DAVBackend.php
+++ b/lib/Kolab/Utils/DAVBackend.php
@@ -47,7 +47,7 @@ class DAVBackend
public static function get_storage_folder($uid, $type)
{
foreach (kolab_storage::get_folders($type) as $folder) {
- if (self::get_uid($folder) == $uid)
+ if ($folder->get_uid() == $uid)
return $folder;
}
@@ -55,45 +55,6 @@ class DAVBackend
}
/**
- * Helper method to extract folder UID metadata
- *
- * @param object \kolab_storage_folder Folder to get UID for
- * @return string Folder's UID
- */
- public static function get_uid($folder)
- {
- // UID is defined in folder METADATA
- $metakeys = array(self::IMAP_UID_KEY, self::IMAP_UID_KEY_PRIVATE, self::IMAP_UID_KEY_CYRUS);
- $metadata = $folder->get_metadata($metakeys);
- foreach ($metakeys as $key) {
- if (($uid = $metadata[$key])) {
- return $uid;
- }
- }
-
- // generate a folder UID and set it to IMAP
- $uid = rtrim(chunk_split(md5($folder->name . $folder->get_owner()), 12, '-'), '-');
- self::set_uid($folder, $uid);
-
- return $uid;
- }
-
- /**
- * Helper method to set an UID value to the given IMAP folder instance
- *
- * @param object \kolab_storage_folder Folder to set UID
- * @param string Folder's UID
- * @return boolean True on succes, False on failure
- */
- public static function set_uid($folder, $uid)
- {
- if (!($success = $folder->set_metadata(array(self::IMAP_UID_KEY => $uid)))) {
- $success = $folder->set_metadata(array(self::IMAP_UID_KEY_PRIVATE => $uid));
- }
- return $success;
- }
-
- /**
* Build an absolute URL with the given parameters
*/
public static function abs_url($parts = array())
@@ -243,7 +204,7 @@ class DAVBackend
// save UID in folder annotations
if ($folder = kolab_storage::get_folder($fname)) {
- self::set_uid($folder, $uid);
+ $folder->set_uid($uid);
}
return $uid;