From cea956cf6a28aa1a4fede59a9309ec626c4ebc2e Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 14 May 2009 09:18:36 -0400
Subject: [PATCH] - Fix autocomplete problem with capital letters (#1485792)

---
 CHANGELOG                           |    1 +
 program/steps/mail/autocomplete.inc |    2 --
 program/js/app.js                   |    7 +++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 55e7001..2189aa6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix autocomplete problem with capital letters (#1485792)
 - Support UUencode content encoding (#1485839)
 - Minimize chance of race condition in session handling (#1485659, #1484678)
 - Fix session handling on non-session SQL query error (#1485734)
diff --git a/program/js/app.js b/program/js/app.js
index 2fb6ce5..da480aa 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2564,11 +2564,14 @@
     q = q.replace(/(^\s+|\s+$)/g, '').toLowerCase();
 
     // Don't (re-)search if string is empty or if the last results are still active
-    if (!q.length || q == this.ksearch_value)
+    if (q == this.ksearch_value)
       return;
-
+    
     this.ksearch_value = q;
     
+    if (!q.length)
+      return;
+    
     this.display_message(this.get_label('searching'), 'loading', true);
     this.http_post('autocomplete', '_search='+urlencode(q));
   };
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index b1aba7d..5b89ff0 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -31,11 +31,9 @@
 
     if ($result = $abook->search(array('email','name'), $search)) {
       while ($sql_arr = $result->iterate()) {
-        if (stripos((string)$sql_arr['email'], $search) !== false || stripos((string)$sql_arr['name'], $search) !== false) {
           $contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
 	  if (count($contacts) >= $MAXNUM)
             break 2;
-        }
       }
     }
   }

--
Gitblit v1.9.1