[Pkg-owncloud-commits] [php-sabre-vobject] 89/106: Fixes #112.
David Prévot
taffit at moszumanska.debian.org
Fri Aug 22 15:11:08 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 5fdc73c9b4d6725a3abada13907c28a8e0b6e916
Author: Evert Pot <me at evertpot.com>
Date: Mon Aug 11 22:36:48 2014 -0400
Fixes #112.
---
ChangeLog.md | 1 +
lib/ITip/Broker.php | 14 +++++-
lib/Recur/EventIterator.php | 5 ++-
tests/VObject/ITip/BrokerNewEventTest.php | 7 ++-
tests/VObject/ITip/BrokerProcessMessageTest.php | 58 +++++++++++++++++++++++++
5 files changed, 80 insertions(+), 5 deletions(-)
diff --git a/ChangeLog.md b/ChangeLog.md
index 757ecea..dda1a08 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -5,6 +5,7 @@ ChangeLog
------------------
* #111: iTip Broker does not process attendee adding events to EXDATE.
+* #112: EventIterator now sets TZID on RECURRENCE-ID.
3.3.0 (2014-08-07)
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 14dc8d1..5133b10 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -367,7 +367,6 @@ class Broker {
$newObject->EXDATE,
$newObject->RDATE
);
- $newObject->{'RECURRENCE-ID'} = $recurId;
$attendeeFound = false;
if (isset($newObject->ATTENDEE)) {
foreach($newObject->ATTENDEE as $attendee) {
@@ -654,6 +653,7 @@ class Broker {
$organizer = null;
$organizerName = null;
$sequence = null;
+ $timezone = null;
// Now we need to collect a list of attendees, and which instances they
// are a part of.
@@ -663,6 +663,7 @@ class Broker {
$exdate = array();
foreach($calendar->VEVENT as $vevent) {
+
if (is_null($uid)) {
$uid = $vevent->UID->getValue();
} else {
@@ -670,6 +671,11 @@ class Broker {
throw new ITipException('If a calendar contained more than one event, they must have the same UID.');
}
}
+
+ if (!isset($vevent->DTSTART)) {
+ throw new ITipException('An event MUST have a DTSTART property.');
+ }
+
if (isset($vevent->ORGANIZER)) {
if (is_null($organizer)) {
$organizer = $vevent->ORGANIZER->getValue();
@@ -722,6 +728,9 @@ class Broker {
}
$instances[$value] = $vevent;
+ if ($value==='master') {
+ $timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
+ }
}
@@ -734,7 +743,8 @@ class Broker {
'instances',
'attendees',
'sequence',
- 'exdate'
+ 'exdate',
+ 'timezone'
);
}
diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php
index 0e665f1..8e69e24 100644
--- a/lib/Recur/EventIterator.php
+++ b/lib/Recur/EventIterator.php
@@ -247,7 +247,8 @@ class EventIterator implements \Iterator {
$event->RRULE,
$event->EXDATE,
$event->RDATE,
- $event->EXRULE
+ $event->EXRULE,
+ $event->{'RECURRENCE-ID'}
);
// @codeCoverageIgnoreEnd
@@ -256,7 +257,7 @@ class EventIterator implements \Iterator {
$event->DTEND->setDateTime($this->getDtEnd());
}
if ($this->recurIterator->key() > 0) {
- $event->{'RECURRENCE-ID'} = (string)$event->DTSTART;
+ $event->add('RECURRENCE-ID', $event->DTSTART->getDateTime());
}
return $event;
diff --git a/tests/VObject/ITip/BrokerNewEventTest.php b/tests/VObject/ITip/BrokerNewEventTest.php
index 57bff9c..be6b065 100644
--- a/tests/VObject/ITip/BrokerNewEventTest.php
+++ b/tests/VObject/ITip/BrokerNewEventTest.php
@@ -2,7 +2,7 @@
namespace Sabre\VObject\ITip;
-class BrokerNewTest extends \PHPUnit_Framework_TestCase {
+class BrokerNewEventTest extends \PHPUnit_Framework_TestCase {
function testNoAttendee() {
@@ -10,6 +10,7 @@ class BrokerNewTest extends \PHPUnit_Framework_TestCase {
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foobar
+DTSTART:20140811T220000Z
END:VEVENT
END:VCALENDAR
ICS;
@@ -39,6 +40,7 @@ BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
+DTSTART:20140811T220000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;CN=White:mailto:white at example.org
END:VEVENT
@@ -54,6 +56,7 @@ CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
UID:foobar
+DTSTART:20140811T220000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;CN=White:mailto:white at example.org
END:VEVENT
@@ -379,6 +382,7 @@ BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
+DTSTART:20140811T220000Z
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;CN=White;SCHEDULE-AGENT=CLIENT:mailto:white at example.org
END:VEVENT
@@ -393,6 +397,7 @@ PRODID:-//Sabre//Sabre VObject $version//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
+DTSTART:20140811T220000Z
UID:foobar
ORGANIZER;CN=Strunk:mailto:strunk at example.org
ATTENDEE;CN=White;SCHEDULE-AGENT=CLIENT:mailto:white at example.org
diff --git a/tests/VObject/ITip/BrokerProcessMessageTest.php b/tests/VObject/ITip/BrokerProcessMessageTest.php
index e4addae..5a6a775 100644
--- a/tests/VObject/ITip/BrokerProcessMessageTest.php
+++ b/tests/VObject/ITip/BrokerProcessMessageTest.php
@@ -333,6 +333,64 @@ ICS;
}
+ function testReplyNewExceptionTz() {
+
+ // This is a reply to 1 instance of a recurring event. This should
+ // automatically create an exception.
+ $itip = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REPLY
+BEGIN:VEVENT
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo at example.org
+ORGANIZER:mailto:bar at example.org
+SEQUENCE:2
+RECURRENCE-ID;TZID=America/Toronto:20140725T000000
+UID:foobar
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $old = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+SEQUENCE:2
+UID:foobar
+RRULE:FREQ=DAILY
+DTSTART;TZID=America/Toronto:20140724T000000
+ATTENDEE:mailto:foo at example.org
+ORGANIZER:mailto:bar at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $expected = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+SEQUENCE:2
+UID:foobar
+RRULE:FREQ=DAILY
+DTSTART;TZID=America/Toronto:20140724T000000
+ATTENDEE:mailto:foo at example.org
+ORGANIZER:mailto:bar at example.org
+END:VEVENT
+BEGIN:VEVENT
+SEQUENCE:2
+UID:foobar
+DTSTART;TZID=America/Toronto:20140725T000000
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:foo at example.org
+ORGANIZER:mailto:bar at example.org
+RECURRENCE-ID;TZID=America/Toronto:20140725T000000
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $result = $this->process($itip, $old, $expected);
+
+ }
+
function testReplyPartyCrashCreateExcepton() {
// IN this test there's a recurring event that has an exception. The
--
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