summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-06-24 10:55:36 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-06-24 10:55:36 (GMT)
commit8ac67c4b87d9bf90b004c703b15c8deee7d1fc90 (patch)
tree7d692b5254497796c689bd511ac3143e18c4246d /plugins
parentd363efb7909b05c6e281d9eddd3821d6bafd5a13 (diff)
downloadroundcubemail-plugins-kolab-8ac67c4b87d9bf90b004c703b15c8deee7d1fc90.tar.gz
Revert "Keep libkolab API for event recurrence exceptions consistent for Kolab v2. The format doesn't allow to save exceptions inline, thus save them as individual events"
This reverts commit 6776c49a19e597bd94597df0ec6fc13a5580e079.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/libkolab/lib/kolab_format_event.php2
-rw-r--r--plugins/libkolab/lib/kolab_storage_folder.php59
2 files changed, 8 insertions, 53 deletions
diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php
index 2db745c..acf0b67 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -190,7 +190,7 @@ class kolab_format_event extends kolab_format_xcal
}
// read exception event objects
- if (($exceptions = $this->obj->exceptions()) && is_object($exceptions) && $exceptions->size()) {
+ if (($exceptions = $this->obj->exceptions()) && $exceptions->size()) {
for ($i=0; $i < $exceptions->size(); $i++) {
if (($exobj = $exceptions->get($i))) {
$exception = new kolab_format_event($exobj);
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index cf2c8bd..7831140 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -546,9 +546,9 @@ class kolab_storage_folder
// detect old Kolab 2.0 format
if (strpos($xmlhead, '<' . $xmltype) !== false && strpos($xmlhead, 'xmlns=') === false)
- $format_version = '2.0';
+ $format_version = 2.0;
else
- $format_version = '3.0'; // assume 3.0
+ $format_version = 3.0; // assume 3.0
}
// get Kolab format handler for the given type
@@ -587,6 +587,7 @@ class kolab_storage_folder
return false;
}
+
/**
* Save an object in this folder.
*
@@ -657,11 +658,6 @@ class kolab_storage_folder
}
}
- // save recurrence exceptions as individual objects due to lack of support in Kolab v2 format
- if (kolab_storage::$version == '2.0' && $object['recurrence']['EXCEPTIONS']) {
- $this->save_recurrence_exceptions($object, $type);
- }
-
// check IMAP BINARY extension support for 'file' objects
// allow configuration to workaround bug in Cyrus < 2.4.17
$rcmail = rcube::get_instance();
@@ -669,12 +665,6 @@ class kolab_storage_folder
// generate and save object message
if ($raw_msg = $this->build_message($object, $type, $binary)) {
- // resolve old msguid before saving
- if ($uid && empty($object['_msguid']) && ($msguid = $this->cache->uid2msguid($uid))) {
- $object['_msguid'] = $msguid;
- $object['_mailbox'] = $this->name;
- }
-
if (is_array($raw_msg)) {
$result = $this->imap->save_message($this->name, $raw_msg[0], $raw_msg[1], true, null, null, $binary);
@unlink($raw_msg[0]);
@@ -688,6 +678,10 @@ class kolab_storage_folder
$this->imap->delete_message($object['_msguid'], $object['_mailbox']);
$this->cache->set($object['_msguid'], false, $object['_mailbox']);
}
+ else if ($result && $uid && ($msguid = $this->cache->uid2msguid($uid))) {
+ $this->imap->delete_message($msguid, $this->name);
+ $this->cache->set($object['_msguid'], false);
+ }
// update cache with new UID
if ($result) {
@@ -699,45 +693,6 @@ class kolab_storage_folder
return $result;
}
- /**
- * Save recurrence exceptions as individual objects.
- * The Kolab v2 format doesn't allow us to save fully embedded exception objects.
- *
- * @param array Hash array with event properties
- * @param string Object type
- */
- private function save_recurrence_exceptions(&$object, $type = null)
- {
- if ($object['recurrence']['EXCEPTIONS']) {
- $exdates = array();
- foreach ((array)$object['recurrence']['EXDATE'] as $exdate) {
- $key = is_a($exdate, 'DateTime') ? $exdate->format('Y-m-d') : strval($exdate);
- $exdates[$key] = 1;
- }
-
- // save every exception as individual object
- foreach((array)$object['recurrence']['EXCEPTIONS'] as $exception) {
- $exception['uid'] = $object['uid'] . '-' . $exception['start']->format('Ymd');
- $exception['recurrence-id'] = $exception['start']->format('Y-m-d');
- $exception['sequence'] = $object['sequence'] + 1;
-
- unset($exception['recurrence'], $exception['organizer'], $exception['attendees']);
- $this->save($exception, $type, $exception['uid']);
-
- // set UNTIL date if we have a thisandfuture exception
- if ($exception['thisandfuture']) {
- $untildate = clone $exception['start'];
- $untildate->sub(new DateInterval('P1D'));
- $object['recurrence']['UNTIL'] = $untildate;
- unset($object['recurrence']['COUNT']);
- }
- else if (!$exdates[$exception['start']->format('Y-m-d')])
- $object['recurrence']['EXDATE'][] = clone $exception['start'];
- }
-
- unset($object['recurrence']['EXCEPTIONS']);
- }
- }
/**
* Delete the specified object from this folder.