[Kolab-devel] [issue3845] fix for automatic address completion for event attendees

issues at kolab.org issues at kolab.org
Thu Sep 10 10:02:46 CEST 2009


New submission from Sönke Schwardt-Krummrich <schwardt at univention.de>:

Most of the time address completion in kronolith returns only very few or
no hits if n characters are given but returns a lot more hits on n+1 characters.
Attached patch fixes this behaviour.

example:
you're looking for "alice". After pressing each character autocompletion list is
updated. Results for entered substrings (your mileage may vary):
"a": 23 hits
"al": 0 hits
"ali": 3 hits
"alic": 1 hit

----------
files: t_kronolith_HK_UV_fixAddressCompletion.diff
keyword: web client
messages: 21578
nosy: schwardt
priority: bug
status: unread
title: fix for automatic address completion for event attendees

______________________________________
Kolab issue tracker <issues at kolab.org>
<https://issues.kolab.org/issue3845>
______________________________________
-------------- next part --------------
Patch by schwardt at univention.de (Tue Sep 8 17:32:37 2009 +0200):

kronolith: fixes automatic address completion for event attendees

Most of the time address completion returns only very few or no hits if
n characters are given but returns a lot more hits on n+1 characters.

--- a/horde-webmail/kronolith/lib/Imple/ContactAutoCompleter.php
+++ b/horde-webmail/kronolith/lib/Imple/ContactAutoCompleter.php
@@ -175,46 +175,30 @@ class Imple_ContactAutoCompleter extends Imple {
                 }
             } else {
                 $res = $results[$tmp];
-                if (count($res) == 1) {
-                    if ($full) {
-                        if (strpos($res[0]['email'], ',') !== false) {
-                            if ($vars === null) {
-                                $vars = get_class_vars('MIME');
-                            }
-                            $arr[$i] = MIME::_rfc822Encode($res[0]['name'], $vars['rfc822_filter'] . '.') . ': ' . $res[0]['email'] . ';';
-                        } else {
-                            list($mbox, $host) = explode('@', $res[0]['email']);
-                            $arr[$i] = MIME::rfc822WriteAddress($mbox, $host, $res[0]['name']);
-                        }
-                    } else {
-                        $arr[$i] = $res[0]['email'];
-                    }
-                } else {
-                    /* Handle the multiple case - we return an array
-                     * with all found addresses. */
-                    $arr[$i] = array($arr[$i]);
-                    foreach ($res as $one_res) {
-                        if (empty($one_res['email'])) {
-                            continue;
-                        }
-                        if ($full) {
-                            if (strpos($one_res['email'], ',') !== false) {
-                                if ($vars === null) {
-                                    $vars = get_class_vars('MIME');
-                                }
-                                $arr[$i][] = MIME::_rfc822Encode($one_res['name'], $vars['rfc822_filter'] . '.') . ': ' . $one_res['email'] . ';';
-                            } else {
-                                $mbox_host = explode('@', $one_res['email']);
-                                if (isset($mbox_host[1])) {
-                                    $arr[$i][] = MIME::rfc822WriteAddress($mbox_host[0], $mbox_host[1], $one_res['name']);
-                                }
-                            }
-                        } else {
-                            $arr[$i][] = $one_res['email'];
-                        }
-                    }
-                    $ambiguous = true;
-                }
+				/* Handle the multiple case - we return an array
+				 * with all found addresses. */
+				$arr[$i] = array($arr[$i]);
+				foreach ($res as $one_res) {
+					if (empty($one_res['email'])) {
+						continue;
+					}
+					if ($full) {
+						if (strpos($one_res['email'], ',') !== false) {
+							if ($vars === null) {
+								$vars = get_class_vars('MIME');
+							}
+							$arr[$i][] = MIME::_rfc822Encode($one_res['name'], $vars['rfc822_filter'] . '.') . ': ' . $one_res['email'] . ';';
+						} else {
+							$mbox_host = explode('@', $one_res['email']);
+							if (isset($mbox_host[1])) {
+								$arr[$i][] = MIME::rfc822WriteAddress($mbox_host[0], $mbox_host[1], $one_res['name']);
+							}
+						}
+					} else {
+						$arr[$i][] = $one_res['email'];
+					}
+				}
+				$ambiguous = true;
             }
         }
 


More information about the devel mailing list