[Pkg-owncloud-commits] [php-sabre-vobject] 91/106: Fixes #113.
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 d861426be71768f85d406da4737ccbab07cf6a35
Author: Evert Pot <me at evertpot.com>
Date: Tue Aug 12 01:18:29 2014 -0400
Fixes #113.
---
ChangeLog.md | 1 +
lib/ITip/Broker.php | 21 ++++---
tests/VObject/ITip/BrokerAttendeeReplyTest.php | 84 ++++++++++++++++++++++++--
3 files changed, 90 insertions(+), 16 deletions(-)
diff --git a/ChangeLog.md b/ChangeLog.md
index f4edf42..8ea3fa0 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -8,6 +8,7 @@ ChangeLog
setters on properties. (`$event->DTSTART = new DateTime('now')`).
* #111: iTip Broker does not process attendee adding events to EXDATE.
* #112: EventIterator now sets TZID on RECURRENCE-ID.
+* #113: Timezone support during creation of iTip REPLY messages.
3.3.0 (2014-08-07)
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 5133b10..b89bc22 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -3,6 +3,7 @@
namespace Sabre\VObject\ITip;
use Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\DateTimeParser;
use Sabre\VObject\Reader;
use Sabre\VObject\Recur\EventIterator;
@@ -607,7 +608,7 @@ class Broker {
'SEQUENCE' => $message->sequence,
));
if ($instance['id'] !== 'master') {
- $event->{'RECURRENCE-ID'} = $instance['id'];
+ $event->{'RECURRENCE-ID'} = DateTimeParser::parseDateTime($instance['id'], $eventInfo['timezone']);
}
$organizer = $event->add('ORGANIZER', $message->recipient);
if ($message->recipientName) {
@@ -693,7 +694,10 @@ class Broker {
$exdate = $vevent->EXDATE->getParts();
}
- $value = isset($vevent->{'RECURRENCE-ID'})?$vevent->{'RECURRENCE-ID'}->getValue():'master';
+ $recurId = isset($vevent->{'RECURRENCE-ID'})?$vevent->{'RECURRENCE-ID'}->getValue():'master';
+ if ($recurId==='master') {
+ $timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
+ }
if(isset($vevent->ATTENDEE)) {
foreach($vevent->ATTENDEE as $attendee) {
@@ -709,16 +713,16 @@ class Broker {
'NEEDS-ACTION';
if (isset($attendees[$attendee->getValue()])) {
- $attendees[$attendee->getValue()]['instances'][$value] = array(
- 'id' => $value,
+ $attendees[$attendee->getValue()]['instances'][$recurId] = array(
+ 'id' => $recurId,
'partstat' => $partStat,
);
} else {
$attendees[$attendee->getValue()] = array(
'href' => $attendee->getValue(),
'instances' => array(
- $value => array(
- 'id' => $value,
+ $recurId => array(
+ 'id' => $recurId,
'partstat' => $partStat,
),
),
@@ -727,10 +731,7 @@ class Broker {
}
}
- $instances[$value] = $vevent;
- if ($value==='master') {
- $timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
- }
+ $instances[$recurId] = $vevent;
}
diff --git a/tests/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
index cf19c2f..759598d 100644
--- a/tests/VObject/ITip/BrokerAttendeeReplyTest.php
+++ b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
@@ -268,14 +268,16 @@ ICS;
}
+ /**
+ * 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.
+ */
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
@@ -338,6 +340,76 @@ ICS
}
+ /**
+ * This test is identical to the last, but now we're working with
+ * timezones.
+ *
+ * @depends testCreateReplyByException
+ */
+ function testCreateReplyByExceptionTz() {
+
+
+ $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART;TZID=America/Toronto:20140811T200000
+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;TZID=America/Toronto:20140811T200000
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+EXDATE;TZID=America/Toronto:20140818T200000
+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;TZID=America/Toronto:20140818T200000
+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