forked from extern/egroupware
* CalDAV/Calendar: store and therefore keep external organizer if he has no common name (just email) and also store its common name
This commit is contained in:
parent
082d1813b2
commit
8d3a2d0007
@ -270,7 +270,7 @@ class calendar_bo
|
|||||||
{
|
{
|
||||||
$email = $id;
|
$email = $id;
|
||||||
$name = '';
|
$name = '';
|
||||||
if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/i',$email,$matches))
|
if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/iU',$email,$matches))
|
||||||
{
|
{
|
||||||
$name = $matches[1];
|
$name = $matches[1];
|
||||||
$email = $matches[2];
|
$email = $matches[2];
|
||||||
@ -1487,7 +1487,7 @@ class calendar_bo
|
|||||||
$id2email[$id] = $GLOBALS['egw']->accounts->id2name($id,'account_email');
|
$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].'>' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -533,7 +533,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ORGANIZER':
|
case 'ORGANIZER':
|
||||||
if (!$organizerCN)
|
if (!$organizerURL)
|
||||||
{
|
{
|
||||||
$organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname')
|
$organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname')
|
||||||
. ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"';
|
. ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"';
|
||||||
@ -2691,8 +2691,15 @@ class calendar_ical extends calendar_boupdate
|
|||||||
{
|
{
|
||||||
$role = $attributes['params']['ROLE'];
|
$role = $attributes['params']['ROLE'];
|
||||||
}
|
}
|
||||||
// parse email and cn from attendee
|
// CN explicit given --> use it
|
||||||
if (preg_match('/MAILTO:([@.a-z0-9_-]+)|MAILTO:"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i',
|
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))
|
$attributes['value'],$matches))
|
||||||
{
|
{
|
||||||
$email = $matches[1] ? $matches[1] : $matches[3];
|
$email = $matches[1] ? $matches[1] : $matches[3];
|
||||||
@ -2731,7 +2738,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
$uid = $this->user;
|
$uid = $this->user;
|
||||||
}
|
}
|
||||||
// check principal url from CalDAV here after X-EGROUPWARE-UID and to get optional X-EGROUPWARE-QUANTITY
|
// 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
|
// try to find an email address
|
||||||
if (!$uid && $email && ($uid = $GLOBALS['egw']->accounts->name2id($email, 'account_email')))
|
if (!$uid && $email && ($uid = $GLOBALS['egw']->accounts->name2id($email, 'account_email')))
|
||||||
|
@ -1078,6 +1078,10 @@ class calendar_uiforms extends calendar_ui
|
|||||||
}
|
}
|
||||||
elseif (($info = $this->bo->resource_info($uid)))
|
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 $info['name'] ? $info['name'] : $info['email'];
|
||||||
}
|
}
|
||||||
return '#'.$uid;
|
return '#'.$uid;
|
||||||
|
Loading…
Reference in New Issue
Block a user