* Mail: correctly quote name / personal part containing German umlauts or special chars when searching for email addresses in compose

This commit is contained in:
Ralf Becker 2015-06-08 14:26:25 +00:00
parent 58e4df159d
commit f4decee1b9
2 changed files with 9 additions and 5 deletions

View File

@ -1461,7 +1461,7 @@ class addressbook_bo extends addressbook_so
*/ */
function link_query($pattern, Array &$options = array()) function link_query($pattern, Array &$options = array())
{ {
$filter = $result = $criteria = array(); $result = $criteria = array();
$limit = false; $limit = false;
if ($pattern) if ($pattern)
{ {
@ -1483,8 +1483,12 @@ class addressbook_bo extends addressbook_so
$cfs = $this->read_customfields($ids); $cfs = $this->read_customfields($ids);
foreach($contacts as $contact) foreach($contacts as $contact)
{ {
$result[$contact['id']] = $this->link_title($contact+(array)$cfs[$contact['id']]). $result[$contact['id']] = $this->link_title($contact+(array)$cfs[$contact['id']]);
($options['type'] === 'email' ? ' <'.$contact['email'].'>' : ''); // make sure to return a correctly quoted rfc822 address, if requested
if ($options['type'] === 'email')
{
$result[$contact['id']] = imap_rfc822_write_address($contact['email'], '', $result[$contact['id']]);
}
// show category color // show category color
if ($contact['cat_id'] && ($color = etemplate::cats2color($contact['cat_id']))) if ($contact['cat_id'] && ($color = etemplate::cats2color($contact['cat_id'])))
{ {

View File

@ -3314,7 +3314,7 @@ class mail_compose
{ {
$contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']); $contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']);
} }
$completeMailString = trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn']) .' <'. trim($email) .'>'; $completeMailString = imap_rfc822_write_address(trim($email), '', trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn']));
if(!empty($email) && in_array($completeMailString ,$results) === false) { if(!empty($email) && in_array($completeMailString ,$results) === false) {
$results[] = array( $results[] = array(
'id'=>$completeMailString, 'id'=>$completeMailString,
@ -3335,7 +3335,7 @@ class mail_compose
{ {
$group = $GLOBALS['egw']->accounts->read($g_id); $group = $GLOBALS['egw']->accounts->read($g_id);
if(!$group['account_email']) continue; if(!$group['account_email']) continue;
$completeMailString = trim($name) .' <'. trim($group['account_email']) .'>'; $completeMailString = imap_rfc822_write_address(trim($group['account_email']), '', $name);
$results[] = array( $results[] = array(
'id' => $completeMailString, 'id' => $completeMailString,
'label' => $completeMailString, 'label' => $completeMailString,