Page MenuHomePhorge

D515.1775762496.diff
No OneTemporary

Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None

D515.1775762496.diff

diff --git a/lib/kolab_sync.php b/lib/kolab_sync.php
--- a/lib/kolab_sync.php
+++ b/lib/kolab_sync.php
@@ -82,7 +82,7 @@
// e.g. are not using output or rcmail objects or
// doesn't throw errors when using them
$plugins = (array)$this->config->get('activesync_plugins', array('kolab_auth'));
- $plugins = array_unique(array_merge($plugins, array('libkolab')));
+ $plugins = array_unique(array_merge($plugins, array('libcalendaring', 'libkolab')));
// Initialize/load plugins
$this->plugins = kolab_sync_plugin_api::get_instance();
diff --git a/lib/kolab_sync_data.php b/lib/kolab_sync_data.php
--- a/lib/kolab_sync_data.php
+++ b/lib/kolab_sync_data.php
@@ -92,6 +92,11 @@
protected $imap_folders = array();
/**
+ * Shortcut to logging.
+ */
+ protected $log;
+
+ /**
* Timezone
*
* @var string
@@ -186,6 +191,8 @@
$this->defaultRootFolder = $this->defaultFolder . '::Syncroton';
+ $this->log = Syncroton_Registry::get('loggerBackend');
+
// set internal timezone of kolab_format to user timezone
try {
$this->timezone = rcube::get_instance()->config->get('timezone', 'GMT');
@@ -954,18 +961,16 @@
$crc = $matches[1];
$uid = $matches[2];
- if (strlen($entryid) >= 64) {
- foreach ($folder->select(array(array('uid', '~*', $uid))) as $object) {
- if (($object['uid'] == $uid || strpos($object['uid'], $uid) === 0)
- && $crc == $this->objectCRC($object['uid'], $folder)
- ) {
- $object['_folderid'] = $folderid;
- return $object;
- }
+ foreach ($folder->select(array(array('uid', '~*', $uid))) as $object) {
+ if (($object['uid'] == $uid || strpos($object['uid'], $uid) === 0)
+ && $crc == $this->objectCRC($object['uid'], $folder)
+ ) {
+ $object['_folderid'] = $folderid;
+ return $object;
}
-
- continue;
}
+
+ continue;
}
// Or (faster) strict UID matching...
diff --git a/lib/kolab_sync_data_calendar.php b/lib/kolab_sync_data_calendar.php
--- a/lib/kolab_sync_data_calendar.php
+++ b/lib/kolab_sync_data_calendar.php
@@ -506,6 +506,65 @@
*/
public function setAttendeeStatus(Syncroton_Model_MeetingResponse $request)
{
+ /*
+ * The request actually involves an iTip request.
+ *
+ * - Get to the iTip,
+ * - Extract the event UID,
+ * - If not already an event in the user's calendar(s), create the event,
+ * - If already an event, update that event.
+ */
+
+ $object = $this->parseMessageId($request->requestId);
+ $message = new rcube_message($object['uid'], $object['foldername']);
+
+ // Parse the message
+ $libcal = libcalendaring::get_instance();
+ $libcal->mail_message_load(array('object' => $message));
+ $ical_objects = $libcal->get_mail_ical_objects();
+
+ $uid = $ical_objects->objects[0]['uid'];
+
+ // Search the user's (event) folders
+ $folders = $this->listFolders();
+
+ $serverIds = Array();
+ foreach ($folders as $folder => $attrs) {
+ $serverIds[] = $this->serverId($uid, $attrs['imap_name']);
+ }
+
+ // Go search for a match
+ $existing_event = NULL;
+
+ foreach ($serverIds as $serverId) {
+ foreach ($folders as $folderid => $attrs) {
+ $existing_event = $this->getObject($folderid, $serverId);
+ if ($existing_event !== NULL) {
+ break;
+ }
+ }
+
+ if ($existing_event !== NULL) {
+ break;
+ }
+ }
+
+ /*
+ Consider;
+
+ - $existing_event->sensitivity (private, confidential, public)
+ - $existing_event->attendees[$x]->{role,rsvp,status}
+ - $request->userresponse
+ */
+
+ if ($existing_event !== NULL) {
+ // This is an existing event that needs updating
+ $this->log->debug("This is an existing event that needs updating");
+ } else {
+ // This is a new event
+ $this->log->debug("This is a new event");
+ }
+
// @TODO: not implemented
throw new Syncroton_Exception_Status_MeetingResponse(Syncroton_Exception_Status_MeetingResponse::MEETING_ERROR);
}
@@ -698,4 +757,26 @@
$entry->endTime = $rounded;
}
}
+
+ private function parseMessageId($entryid)
+ {
+ // replyEmail/forwardEmail
+ if (is_array($entryid)) {
+ $entryid = $entryid['itemId'];
+ }
+
+ list($folderid, $uid) = explode('::', $entryid);
+ $foldername = $this->backend->folder_id2name($folderid, $this->device->deviceid);
+
+ if ($foldername === null || $foldername === false) {
+ // @TODO exception?
+ return null;
+ }
+
+ return array(
+ 'uid' => $uid,
+ 'folderid' => $folderid,
+ 'foldername' => $foldername,
+ );
+ }
}

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 9, 7:21 PM (20 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18852721
Default Alt Text
D515.1775762496.diff (5 KB)

Event Timeline