[Pkg-owncloud-commits] [php-sabre-vobject] 88/106: Fixes #111.

David Prévot taffit at moszumanska.debian.org
Fri Aug 22 15:11:07 UTC 2014


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

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

commit da0120dc0f8284c300480ef2a023aa8db051272f
Author: Evert Pot <me at evertpot.com>
Date:   Mon Aug 11 21:24:09 2014 -0400

    Fixes #111.
---
 ChangeLog.md                                   |  6 +++
 lib/ITip/Broker.php                            | 23 ++++++++-
 lib/Version.php                                |  2 +-
 tests/VObject/ITip/BrokerAttendeeReplyTest.php | 70 ++++++++++++++++++++++++++
 4 files changed, 98 insertions(+), 3 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 020f0e5..757ecea 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,6 +1,12 @@
 ChangeLog
 =========
 
+3.3.1 (2014-??-??)
+------------------
+
+* #111: iTip Broker does not process attendee adding events to EXDATE.
+
+
 3.3.0 (2014-08-07)
 ------------------
 
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index eef1094..14dc8d1 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -562,6 +562,25 @@ class Broker {
 
         }
 
+        // We need to also look for differences in EXDATE. If there are new
+        // items in EXDATE, it means that an attendee deleted instances of an
+        // event, which means we need to send DECLINED specifically for those
+        // instances.
+        // We only need to do that though, if the master event is not declined.
+        if ($instances['master']['newstatus'] !== 'DECLINED') {
+            foreach($eventInfo['exdate'] as $exDate) {
+
+                if (!in_array($exDate, $oldEventInfo['exdate'])) {
+                    $instances[$exDate] = array(
+                        'id' => $exDate,
+                        'oldstatus' => $instances['master']['oldstatus'],
+                        'newstatus' => 'DECLINED',
+                    );
+                }
+
+            }
+        }
+
         $message = new Message();
         $message->uid = $eventInfo['uid'];
         $message->method = 'REPLY';
@@ -641,7 +660,7 @@ class Broker {
         $attendees = array();
 
         $instances = array();
-        $exdate = null;
+        $exdate = array();
 
         foreach($calendar->VEVENT as $vevent) {
             if (is_null($uid)) {
@@ -664,7 +683,7 @@ class Broker {
             if (is_null($sequence) && isset($vevent->SEQUENCE)) {
                 $sequence = $vevent->SEQUENCE->getValue();
             }
-            if (is_null($exdate) && isset($vevent->EXDATE)) {
+            if (isset($vevent->EXDATE)) {
                 $exdate = $vevent->EXDATE->getParts();
             }
 
diff --git a/lib/Version.php b/lib/Version.php
index e126a98..84721ef 100644
--- a/lib/Version.php
+++ b/lib/Version.php
@@ -14,6 +14,6 @@ class Version {
     /**
      * Full version number
      */
-    const VERSION = '3.3.0';
+    const VERSION = '3.3.1';
 
 }
diff --git a/tests/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
index b2c95f7..cf19c2f 100644
--- a/tests/VObject/ITip/BrokerAttendeeReplyTest.php
+++ b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
@@ -268,6 +268,76 @@ ICS;
 
     }
 
+    function testCreateReplyByException() {
+
+        // In this test, an event exists in an attendees calendar. The event
+        // is recurring, and the attendee deletes 1 instance of the event.
+        // This instance shows up in EXDATE
+        //
+        // This should automatically generate a DECLINED message for that
+        // specific instance.
+
+        $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART:20140811T200000Z
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $newMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART:20140811T200000Z
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+EXDATE:20140818T200000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $version = \Sabre\VObject\Version::VERSION;
+        $expected = array(
+            array(
+                'uid' => 'foobar',
+                'method' => 'REPLY',
+                'component' => 'VEVENT',
+                'sender' => 'mailto:one at example.org',
+                'senderName' => null,
+                'recipient' => 'mailto:organizer at example.org',
+                'recipientName' => null,
+                'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+RECURRENCE-ID:20140818T200000Z
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE;PARTSTAT=DECLINED:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS
+
+            ),
+        );
+        $result = $this->parse($oldMessage, $newMessage, $expected);
+
+    }
+
     function parse($oldMessage, $newMessage, $expected = array()) {
 
         $broker = new Broker();

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



More information about the Pkg-owncloud-commits mailing list