[Pkg-owncloud-commits] [php-sabre-vobject] 15/106: The function for updating events can also deal with new events.
David Prévot
taffit at moszumanska.debian.org
Fri Aug 22 15:10:55 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 624c8ba45f626a8bc481487e1e267a7bfe4f4db9
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Sat Jul 19 12:09:22 2014 -0400
The function for updating events can also deal with new events.
---
lib/Sabre/VObject/ITip/Broker.php | 89 +--------------------------------------
1 file changed, 2 insertions(+), 87 deletions(-)
diff --git a/lib/Sabre/VObject/ITip/Broker.php b/lib/Sabre/VObject/ITip/Broker.php
index 527252e..eceee23 100644
--- a/lib/Sabre/VObject/ITip/Broker.php
+++ b/lib/Sabre/VObject/ITip/Broker.php
@@ -187,98 +187,13 @@ class Broker {
$userHref = (array)$userHref;
$organizer = (string)$calendar->VEVENT->ORGANIZER;
if (in_array($organizer, $userHref)) {
- if ($oldCalendar) {
- return $this->parseUpdatedEventForOrganizer($calendar, $eventInfo, $oldCalendar, $oldEventInfo);
- } else {
- return $this->parseNewEventForOrganizer($calendar, $eventInfo);
- }
+ return $this->parseEventForOrganizer($calendar, $eventInfo, $oldEventInfo);
}
return array();
}
/**
- * This function parses a VCALENDAR object, and if the object had an
- * organizer and attendees, it will generate iTip messages for every
- * attendee.
- *
- * If the passed object did not have any attendees, no messages will be
- * created.
- *
- * @param VCalendar $calendar
- * @param array $eventInfo
- * @return array
- */
- protected function parseNewEventForOrganizer(VCalendar $calendar, array $eventInfo) {
-
- // Now we generate an iTip message for each attendee.
- $messages = array();
-
- foreach($eventInfo['attendees'] as $attendee) {
-
- // An organizer can also be an attendee. We should not generate any
- // messages for those.
- if ($attendee['href']===$eventInfo['organizer']) {
- continue;
- }
-
- $message = new Message();
- $message->uid = $eventInfo['uid'];
- $message->component = 'VEVENT';
- $message->method = 'REQUEST';
- $message->sender = $eventInfo['organizer'];
- $message->senderName = $eventInfo['organizerName'];
- $message->recipient = $attendee['href'];
- $message->recipientName = $attendee['name'];
- $message->sequence = $eventInfo['sequence'];
-
- // Creating the new iCalendar body.
- $icalMsg = new VCalendar();
- $icalMsg->METHOD = $message->method;
-
- foreach($attendee['instances'] as $instanceId) {
-
- $currentEvent = clone $eventInfo['instances'][$instanceId];
- if ($instanceId === 'master') {
-
- // We need to find a list of events that the attendee
- // is not a part of to add to the list of exceptions.
- $exceptions = array();
- foreach($eventInfo['instances'] as $instanceId=>$vevent) {
- if (!in_array($instanceId, $attendee['instances'])) {
- $exceptions[] = $instanceId;
- }
- }
-
- // If there were exceptions, we need to add it to an
- // existing EXDATE property, if it exists.
- if ($exceptions) {
- if (isset($currentEvent->EXDATE)) {
- $currentEvent->EXDATE->setParts(array_merge(
- $currentEvent->EXDATE->getParts(),
- $exceptions
- ));
- } else {
- $currentEvent->EXDATE = $exceptions;
- }
- }
-
- }
-
- $icalMsg->add($currentEvent);
-
- }
-
- $message->message = $icalMsg;
- $messages[] = $message;
-
- }
-
- return $messages;
-
- }
-
- /**
* This method is used in cases where an event got updated, and we
* potentially need to send emails to attendees to let them know of updates
* in the events.
@@ -292,7 +207,7 @@ class Broker {
* @param array $oldEventInfo
* @return array
*/
- protected function parseUpdatedEventForOrganizer(VCalendar $calendar, array $eventInfo, VCalendar $oldCalendar, array $oldEventInfo) {
+ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo, array $oldEventInfo) {
// Shortcut for noop
if (!$oldEventInfo['attendees'] && !$eventInfo['attendees']) {
--
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