Page MenuHomePhorge

D194.1775335260.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D194.1775335260.diff

diff --git a/lib/Kolab/FreeBusy/SourceIMAP.php b/lib/Kolab/FreeBusy/SourceIMAP.php
--- a/lib/Kolab/FreeBusy/SourceIMAP.php
+++ b/lib/Kolab/FreeBusy/SourceIMAP.php
@@ -146,35 +146,11 @@
}
// only consider shared namespace events if user is a confirmed participant (or organizer)
- if (!$read_all && $folder->get_namespace() == 'shared') {
- $participant = false;
- if (is_array($event['organizer']) && !empty($event['organizer']['email'])) {
- $participant = in_array($event['organizer']['email'], $user_email);
- }
- else if (is_array($event['attendees'])) {
- foreach ($event['attendees'] as $attendee) {
- if (in_array($attendee['email'], $user_email)) {
- if ($attendee['status'] == 'ACCEPTED') {
- $participant = true;
- break;
- }
- else if ($attendee['status'] == 'TENTATIVE') {
- $event['free_busy'] = 'tentative';
- $participant = true;
- break;
- }
- }
- }
- }
-
- if (!$participant) {
- $log->debug('Skip shared event', array($event['uid'], $event['title']));
- continue;
- }
- }
// skip declined events
- else if (is_array($event['attendees']) && !$this->check_participation($event, $user_email)) {
- $log->debug('Skip declined event', array($event['uid'], $event['title']));
+ if (!$this->check_participation($event, $user_email, $status)
+ || ($status != 'ACCEPTED' && $status != 'TENTATIVE')
+ ) {
+ $log->debug('Skip shared/declined event', array($event['uid'], $event['title']));
continue;
}
@@ -200,7 +176,7 @@
}
// copied from libvcalendar::_to_ical()
- $ve = $this->to_vevent($event, $calendar);
+ $ve = $this->to_vevent($event, $calendar, $user_email);
if ($event['recurrence']) {
if ($exdates = $event['recurrence']['EXDATE'])
@@ -219,8 +195,8 @@
$exdates[] = $exception['recurrence_date'];
}
// add exception to vcalendar container
- if (!$exception['cancelled'] && $this->check_participation($exception, $user_email)) {
- $vex = $this->to_vevent($exception, $calendar);
+ if (!$exception['cancelled'] && $this->check_participation($exception, $user_email, $status) && $status != 'DECLINED') {
+ $vex = $this->to_vevent($exception, $calendar, $user_email);
$vex->UID = $event['uid'] . '-' . $i;
$calendar->add($vex);
$log->debug("Adding event exception for processing:\n" . $vex->serialize());
@@ -335,7 +311,7 @@
/**
* Helper method to build a Sabre/VObject from the gieven event data
*/
- private function to_vevent($event, $cal)
+ private function to_vevent($event, $cal, $user_email)
{
// copied from libvcalendar::_to_ical()
$ve = $cal->create('VEVENT');
@@ -349,10 +325,9 @@
if (!empty($event['free_busy']))
$ve->add('TRANSP', $event['free_busy'] == 'free' ? 'TRANSPARENT' : 'OPAQUE');
- if ($event['free_busy'] == 'tentative')
- $ve->add('STATUS', 'TENTATIVE');
- else if (!empty($event['status']))
- $ve->add('STATUS', $event['status']);
+ if ($this->check_participation($event, $user_email, $status) && $status) {
+ $ve->add('STATUS', $status);
+ }
return $ve;
}
@@ -360,19 +335,31 @@
/**
* Helper method to check the participation status of the requested user
*/
- private function check_participation($event, $user_email)
+ private function check_participation($event, $user_email, &$status = null)
{
- $result = true;
+ if (is_array($event['organizer']) && !empty($event['organizer']['email'])) {
+ if (in_array($event['organizer']['email'], $user_email)) {
+ $status = 'ACCEPTED';
+ if ($event['free_busy'] == 'tentative') {
+ $status = 'TENTATIVE';
+ }
+ else if (!empty($event['status'])) {
+ $status = $event['status'];
+ }
+
+ return true;
+ }
+ }
if (is_array($event['attendees'])) {
foreach ($event['attendees'] as $attendee) {
- if (in_array($attendee['email'], $user_email) && $attendee['status'] == 'DECLINED') {
- $result = false;
- break;
+ if (in_array($attendee['email'], $user_email)) {
+ $status = $attendee['status'];
+ return true;
}
}
}
- return $result;
+ return false;
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 8:41 PM (13 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18824125
Default Alt Text
D194.1775335260.diff (4 KB)

Event Timeline