fix/workaround for Apple and eMclient not understanding RDATE via CalDAV

sending now master, plus expanded recurrences (like we would do with exceptions)
also no longer export DTSTART in RDATE as unnecessary
This commit is contained in:
ralf 2024-07-04 15:46:49 +02:00
parent 22d5afb811
commit 88720be9a2
2 changed files with 12 additions and 1 deletions

View File

@ -822,6 +822,11 @@ class calendar_groupdav extends Api\CalDAV\Handler
// for recurring events we have to add the exceptions
if ($this->client_shared_uid_exceptions && $event['recur_type'] && !empty($event['uid']))
{
// some clients (Apple, eMclient) do NOT understand RDATE, therefore we expand the recurrences
if ($event['recur_type'] == calendar_rrule::RDATE && in_array(Api\CalDAV\Handler::get_agent(), ['dataaccess', 'iphone', 'calendaragent', 'emclient']))
{
$expand = $readd_master = true;
}
if (is_array($expand))
{
if (isset($expand['start'])) $expand['start'] = $this->vCalendar->_parseDateTime($expand['start']);
@ -831,6 +836,11 @@ class calendar_groupdav extends Api\CalDAV\Handler
if ($expand || !isset($events))
{
$events =& self::get_series($event['uid'], $this->bo, $expand, $user, $event, isset($json) ? 'object' : 'server');
if (!empty($readd_master))
{
array_unshift($events, $event);
}
}
// as alarm is now only on next recurrence, set alarm from original event on master
if ($event['alarm']) $events[0]['alarm'] = $event['alarm'];

View File

@ -703,7 +703,8 @@ class calendar_ical extends calendar_boupdate
$event[$egwFieldName] = $days;
if ($version != '1.0') $parameters[$icalFieldName]['VALUE'] = 'DATE';
}
$vevent->setAttribute($icalFieldName, $event[$egwFieldName], $parameters[$icalFieldName]);
$vevent->setAttribute($icalFieldName, // for RDATE, do not export first RDATE as identical with DTSTART
array_slice($event[$egwFieldName], $icalFieldName === 'RDATE' ? 1 : 0), $parameters[$icalFieldName]);
}
break;