[Pkg-owncloud-commits] [php-sabredav] 20/42: Deliver events to calendars that support VEVENT.

David Prévot taffit at moszumanska.debian.org
Wed Oct 29 20:52:06 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 a179a4d0fe2ff88fcad975f22ad097a15e59acd5
Author: Evert Pot <me at evertpot.com>
Date:   Tue Oct 14 21:21:01 2014 -0400

    Deliver events to calendars that support VEVENT.
    
    Fixes #533.
---
 ChangeLog.md                   |  1 +
 lib/CalDAV/Schedule/Plugin.php | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index a8b16e7..47325fd 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -11,6 +11,7 @@ ChangeLog
   notifications-related functionality, just add this plugin.
 * Changed: Accessing the caldav inbox, outbox or notification collection no
   longer triggers getCalendarsForUser() on backends.
+* #533: New invites are no longer delivered to taks-only calendars.
 
 2.1.0-alpha1 (2014-09-23)
 -------------------------
diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index 3d497da..cda147c 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -230,16 +230,23 @@ class Plugin extends ServerPlugin {
             // meantime we just grab the first calendar in the home-set.
             $calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
 
-            $nodes = $this->server->tree->getNodeForPath($calendarHomePath)->getChildren();
+            $sccs = '{' . self::NS_CALDAV . '}supported-calendar-component-set';
 
-            foreach($nodes as $node) {
-
-                if ($node instanceof ICalendar) {
-
-                    return new Href($calendarHomePath . '/' . $node->getName());
+            $result = $this->server->getPropertiesForPath($calendarHomePath, [
+                '{DAV:}resourcetype',
+                $sccs,
+            ], 1);
 
+            foreach($result as $child) {
+                if (!isset($child[200]['{DAV:}resourcetype']) || !$child[200]['{DAV:}resourcetype']->is('{' . self::NS_CALDAV . '}calendar')) {
+                    // Node is not a calendar.
+                    continue;
+                }
+                if (!isset($child[200][$sccs]) || in_array('VEVENT', $child[200][$sccs]->getValue())) {
+                    // Either there is no supported-calendar-component-set
+                    // (which is fine) or we found one that supports VEVENT.
+                    return new Href($child['href']);
                 }
-
             }
 
         });

-- 
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