thomascube
2010-09-21 cb2bc809ef29f349d38c89e202d821e67bb4c947
program/steps/mail/autocomplete.inc
@@ -37,6 +37,7 @@
}
else if ($book_types && $search = get_input_value('_search', RCUBE_INPUT_GPC, true)) {
  $contacts = array();
  $books_num = count($book_types);
  foreach ($book_types as $id) {
    $abook = $RCMAIL->get_address_book($id);
@@ -44,9 +45,13 @@
    if ($result = $abook->search(array('email','name'), $search, false, true, true, 'email')) {
      while ($sql_arr = $result->iterate()) {
          $contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
        $contact = format_email_recipient($sql_arr['email'], $sql_arr['name']);
        // when we've got more than one book, we need to skip duplicates
        if ($books_num == 1 || !in_array($contact, $contacts)) {
          $contacts[] = $contact;
          if (count($contacts) >= $MAXNUM)
            break 2;
        }
      }
    }
@@ -80,4 +85,3 @@
  return strcoll(trim($name_a, '" '), trim($name_b, '" '));
}
?>