backported Jörgs r30190: Fix iCal attendee CN issue

This commit is contained in:
Ralf Becker 2010-05-18 12:12:10 +00:00
parent 92578f9d02
commit 2aebd3e9c0

View File

@ -474,10 +474,13 @@ class calendar_ical extends calendar_boupdate
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
'()attendee:' . array2string($info) ."\n",3,$this->logfile); '()attendee:' . array2string($info) ."\n",3,$this->logfile);
} }
$participantCN = '"' . (empty($info['cn']) ? $info['name'] : $info['cn']) . '"'; $participantCN = trim(empty($info['cn']) ? $info['name'] : $info['cn']);
$participantCN = str_replace(array('\\', ',', ';', ':'),
array('\\\\', '\\,', '\\;', '\\:'),
$participantCN);
if ($version == '1.0') if ($version == '1.0')
{ {
$participantURL = trim($participantCN . (empty($info['email']) ? '' : ' <' . $info['email'] .'>')); $participantURL = trim('"' . $participantCN . '"' . (empty($info['email']) ? '' : ' <' . $info['email'] .'>'));
} }
else else
{ {
@ -488,7 +491,7 @@ class calendar_ical extends calendar_boupdate
{ {
$organizerURL = $participantURL; $organizerURL = $participantURL;
$organizerCN = $participantCN; $organizerCN = $participantCN;
$organizerUID = $uid; $organizerUID = ($info['type'] != 'e' ? $uid : '');
} }
$attributes['ATTENDEE'][] = $participantURL; $attributes['ATTENDEE'][] = $participantURL;
// RSVP={TRUE|FALSE} // resonse expected, not set in eGW => status=U // RSVP={TRUE|FALSE} // resonse expected, not set in eGW => status=U
@ -563,8 +566,11 @@ class calendar_ical extends calendar_boupdate
{ {
$attributes['ORGANIZER'] = $organizerURL; $attributes['ORGANIZER'] = $organizerURL;
$parameters['ORGANIZER']['CN'] = $organizerCN; $parameters['ORGANIZER']['CN'] = $organizerCN;
if (!empty($organizerUID))
{
$parameters['ORGANIZER']['X-EGROUPWARE-UID'] = $organizerUID; $parameters['ORGANIZER']['X-EGROUPWARE-UID'] = $organizerUID;
} }
}
break; break;
case 'DTSTART': case 'DTSTART':
@ -2686,7 +2692,9 @@ class calendar_ical extends calendar_boupdate
// ... and for provided CN // ... and for provided CN
if (!empty($attributes['params']['CN'])) if (!empty($attributes['params']['CN']))
{ {
$cn = $attributes['params']['CN']; $cn = str_replace(array('\\,', '\\;', '\\:', '\\\\'),
array(',', ';', ':', '\\'),
$attributes['params']['CN']);
if ($cn[0] == '"' && substr($cn,-1) == '"') if ($cn[0] == '"' && substr($cn,-1) == '"')
{ {
$cn = substr($cn,1,-1); $cn = substr($cn,1,-1);