[Pkg-owncloud-commits] [php-sabredav] 96/275: Deal better with incoming messages we don't understand yet.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:55:56 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit a144239f4a54ed73f8b3ff0b5eaf493baa4de9d9
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sun Jul 20 23:12:01 2014 -0400

    Deal better with incoming messages we don't understand yet.
---
 lib/CalDAV/Schedule/Plugin.php | 69 ++++++++----------------------------------
 1 file changed, 13 insertions(+), 56 deletions(-)

diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index 5e19b43..aca75b7 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -377,36 +377,12 @@ class Plugin extends ServerPlugin {
 
         $vObj = Reader::read($data);
 
-        // At the moment we only support VEVENT. VTODO may come later.
-        if (!isset($vObj->VEVENT)) {
-            return;
-        }
-        $vevent = $vObj->VEVENT[0];
-
-        $organizer = null;
-
-        if ($vevent[0]->ORGANIZER) {
-            $organizer = (string)$vevent->ORGANIZER;
-        }
-
-        // If the object doesn't have organizer or attendee information, we can
-        // ignore it.
-        if (!$organizer || !isset($vevent->ATTENDEE)) {
-            return;
-        }
-
         $addresses = $this->getAddressesForPrincipal(
             $parentNode->getOwner()
         );
 
-        // We're only handling creation of new objects by the ORGANIZER.
-        // Support for ATTENDEE will come later.
-        if (!in_array($organizer, $addresses)) {
-            return;
-        }
-
         $broker = new ITip\Broker();
-        $messages = $broker->parseNewEvent($vObj);
+        $messages = $broker->parseEvent($vObj, $addresses);
 
         foreach($messages as $message) {
 
@@ -464,42 +440,12 @@ class Plugin extends ServerPlugin {
 
         $vObj = Reader::read($data);
 
-        // At the moment we only support VEVENT. VTODO may come later.
-        if (!isset($vObj->VEVENT)) {
-            return;
-        }
-
-        // At the moment we only process the first VEVENT. Any other overridden
-        // event will get ignored for the moment.
-        $vevent = $vObj->VEVENT[0];
-
-        $organizer = null;
-
-        if ($vevent->ORGANIZER) {
-            $organizer = (string)$vevent->ORGANIZER;
-        }
-
-        // If the object doesn't have organizer or attendee information, we can
-        // ignore it.
-        if (!$organizer || !isset($vevent->ATTENDEE)) {
-            return;
-        }
-
         $addresses = $this->getAddressesForPrincipal(
             $node->getOwner()
         );
 
-        // We're only handling creation of new objects by the ORGANIZER.
-        // Support for ATTENDEE will come later.
-        if (!in_array($organizer, $addresses)) {
-            return;
-        }
-
-        // Fetching the current event body.
-        $oldEvent = Reader::read($node->get());
-
         $broker = new ITip\Broker();
-        $messages = $broker->parseUpdatedEvent($vObj, $oldEvent);
+        $messages = $broker->parseEvent($vObj, $addresses, $node->get());
 
         foreach($messages as $message) {
 
@@ -637,6 +583,17 @@ class Plugin extends ServerPlugin {
 
         $inbox->createFile($newFileName, $iTipMessage->message->serialize());
 
+        if ($isNewNode && !$newObject) {
+            // We received an iTip message referring to a UID that we don't
+            // have in any calendars yet, and processMessage did not give us a
+            // calendarobject back.
+            //
+            // The implication is that processMessage did not understand the
+            // iTip message.
+            $iTipMessage->scheduleStatus = '5.0;iTip message was not processed by the server, likely because we didn\'t understand it.';
+            return;
+        }
+
         if ($isNewNode) {
             $calendar = $this->server->tree->getNodeForPath($calendarPath);
             $calendar->createFile($newFileName, $newObject->serialize());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list