summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-07-03 14:25:19 +0200
committerAleksander Machniak <alec@alec.pl>2014-07-03 14:25:19 +0200
commit36d004e3d0ad9ff97b66b2e505f6b17fd6d23102 (patch)
treebcea0ab4f689fcd3d176bb0ef70a442e26a12c5a /program/steps/mail
parent5a897b3f69d0fdadd39a0df49f93c01a1bfd8385 (diff)
Added 'contact_search_name' option to define autocompletion entry format
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/autocomplete.inc10
1 files changed, 8 insertions, 2 deletions
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index 71b337a53..c805cd009 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;