summaryrefslogtreecommitdiff
path: root/program/steps/mail/autocomplete.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/autocomplete.inc')
-rw-r--r--program/steps/mail/autocomplete.inc18
1 files changed, 15 insertions, 3 deletions
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index 71b337a53..30b8f2299 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -90,8 +90,14 @@ if (!empty($book_types) && strlen($search)) {
// skip duplicates
if (!in_array($contact, $contacts)) {
- $contacts[] = array('name' => $contact, 'type' => $sql_arr['_type']);
- $sort_keys[] = sprintf('%s %03d', $sql_arr['name'] , $idx++);
+ $contact = array('name' => $contact, 'type' => $sql_arr['_type']);
+
+ if (($display = rcube_addressbook::compose_search_name($sql_arr, $email, $name)) && $display != $contact['name']) {
+ $contact['display'] = $display;
+ }
+
+ $contacts[] = $contact;
+ $sort_keys[] = sprintf('%s %03d', $contact['display'] ?: $name, $idx++);
if (count($contacts) >= $MAXNUM) {
break 2;
@@ -118,7 +124,13 @@ if (!empty($book_types) && strlen($search)) {
if ($group_prop['email']) {
$idx = 0;
foreach ((array)$group_prop['email'] as $email) {
- $contacts[] = array('name' => format_email_recipient($email, $group['name']), 'type' => 'group');
+ $contacts[] = array(
+ 'name' => format_email_recipient($email, $group['name']),
+ 'email' => $email,
+ 'type' => 'group',
+ 'id' => $group['ID'],
+ 'source' => $id,
+ );
$sort_keys[] = sprintf('%s %03d', $group['name'] , $idx++);
if (count($contacts) >= $MAXNUM) {