diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index 33425e4c5c..66b6077a93 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -263,7 +263,7 @@ class calendar_bo { $email = $id; $name = ''; - if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/i',$email,$matches)) + if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/iU',$email,$matches)) { $name = $matches[1]; $email = $matches[2]; @@ -1477,7 +1477,7 @@ class calendar_bo $id2email[$id] = $GLOBALS['egw']->accounts->id2name($id,'account_email'); } } - return $id2lid[$id].($append_email && $id2email[$id] ? ' <'.$id2email[$id].'>' : ''); + return $id2lid[$id].(($append_email || $id[0] == 'e') && $id2email[$id] ? ' <'.$id2email[$id].'>' : ''); } /** diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 8dab5f58c7..4e1647fe75 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -530,7 +530,7 @@ class calendar_ical extends calendar_boupdate break; case 'ORGANIZER': - if (!$organizerCN) + if (!$organizerURL) { $organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname') . ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"'; @@ -2675,8 +2675,15 @@ class calendar_ical extends calendar_boupdate { $role = $attributes['params']['ROLE']; } - // parse email and cn from attendee - if (preg_match('/MAILTO:([@.a-z0-9_-]+)|MAILTO:"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i', + // CN explicit given --> use it + if (strtoupper(substr($attributes['value'], 0, 7)) == 'MAILTO:' && + !empty($attributes['params']['CN'])) + { + $email = substr($attributes['value'], 7); + $cn = $attributes['params']['CN']; + } + // try parsing email and cn from attendee + elseif (preg_match('/MAILTO:([@.a-z0-9_-]+)|MAILTO:"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i', $attributes['value'],$matches)) { $email = $matches[1] ? $matches[1] : $matches[3]; @@ -2715,7 +2722,7 @@ class calendar_ical extends calendar_boupdate $uid = $this->user; } // check principal url from CalDAV here after X-EGROUPWARE-UID and to get optional X-EGROUPWARE-QUANTITY - if (!$uid) $uid = groupdav_principals::url2uid($attributes['value']); + if (!$uid) $uid = groupdav_principals::url2uid($attributes['value'], null, $cn); // try to find an email address if (!$uid && $email && ($uid = $GLOBALS['egw']->accounts->name2id($email, 'account_email'))) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 26ef04604a..f5ab7c89b1 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -848,6 +848,10 @@ class calendar_uiforms extends calendar_ui } elseif (($info = $this->bo->resource_info($uid))) { + if ($uid[0] == 'e' && $info['name'] && $info['name'] != $info['email']) + { + return $info['name'].' <'.$info['email'].'>'; + } return $info['name'] ? $info['name'] : $info['email']; } return '#'.$uid;