From 87e3ed6ed09a9fcd3cab45a6ce674396e51b95bb Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 10 Aug 2006 14:53:07 -0400
Subject: [PATCH] Updated Slovak translation

---
 program/steps/mail/search.inc |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 1424114..e1690ee 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -8,6 +8,7 @@
  |                                                                       |
  +-----------------------------------------------------------------------+
  | Author: Benjamin Smith <defitro@gmail.com>                            |
+ |         Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
 */
@@ -18,6 +19,10 @@
 $IMAP->set_page(1);
 $_SESSION['page'] = 1;
 
+// using encodeURI with javascript "should" give us
+// a correctly UTF-8 encoded query string
+$imap_charset = 'UTF-8';
+
 // get search string
 $str = get_input_value('_search', RCUBE_INPUT_GET);
 $mbox = get_input_value('_mbox', RCUBE_INPUT_GET);
@@ -27,33 +32,33 @@
 // Check the search string for type of search
 if (preg_match("/^from:/i", $str)) {
   list(,$srch) = explode(":", $str);
-  $search = $IMAP->search($mbox, "FROM" ,trim($srch));
+  $search = $IMAP->search($mbox, "HEADER FROM" ,trim($srch), $imap_charset);
   finish_search($mbox, $search);
 }
 else if (preg_match("/^to:/i", $str)) {
   list(,$srch) = explode(":", $str);
-  $search = $IMAP->search($mbox, "TO", trim($srch));
+  $search = $IMAP->search($mbox, "HEADER TO", trim($srch), $imap_charset);
   finish_search($mbox, $search);
 }
 else if (preg_match("/^cc:/i", $str)) {
   list(,$srch) = explode(":", $str);
-  $search = $IMAP->search($mbox, "CC", trim($srch));
+  $search = $IMAP->search($mbox, "HEADER CC", trim($srch), $imap_charset);
   finish_search($mbox, $search);
 }
 else if (preg_match("/^subject:/i", $str)) {
   list(,$srch) = explode(":", $str);
-  $search = $IMAP->search($mbox, "SUBJECT", trim($srch));
+  $search = $IMAP->search($mbox, "HEADER SUBJECT", trim($srch), $imap_charset);
   finish_search($mbox, $search);
 }
 else if (preg_match("/^body:/i", $str)) {
   list(,$srch) = explode(":", $str);
-  $search = $IMAP->search($mbox, "TEXT", trim($srch));
+  $search = $IMAP->search($mbox, "TEXT", trim($srch), $imap_charset);
   finish_search($mbox, $search);
 }
 // search in subject and sender by default
 else {
-  $search = $IMAP->search($mbox, "SUBJECT", trim($str));
-  $search2 = $IMAP->search($mbox, "FROM", trim($str));
+  $search = $IMAP->search($mbox, "HEADER SUBJECT", trim($str), $imap_charset);
+  $search2 = $IMAP->search($mbox, "HEADER FROM", trim($str), $imap_charset);
   finish_search($mbox, array_unique(array_merge($search, $search2)));
 }
 

--
Gitblit v1.9.1