* 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:28:43 +00:00
parent db61f288d8
commit 41b60e9e12
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

@ -3294,7 +3294,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,
@ -3315,7 +3315,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,