[Hastymail-cvs] SF.net SVN: hastymail:[681] trunk/hastymail2
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2008-12-28 22:18:48
|
Revision: 681 http://hastymail.svn.sourceforge.net/hastymail/?rev=681&view=rev Author: sailfrog Date: 2008-12-28 22:18:44 +0000 (Sun, 28 Dec 2008) Log Message: ----------- added a config option to alter the charse used for the IMAP search command Modified Paths: -------------- trunk/hastymail2/CHANGES trunk/hastymail2/hastymail2.conf.example trunk/hastymail2/index.php trunk/hastymail2/lib/imap_class.php Modified: trunk/hastymail2/CHANGES =================================================================== --- trunk/hastymail2/CHANGES 2008-12-28 02:08:19 UTC (rev 680) +++ trunk/hastymail2/CHANGES 2008-12-28 22:18:44 UTC (rev 681) @@ -2,6 +2,8 @@ RELEASE CANDIDATE 3 --------------------------------------- +- Added a config option to alter the charset used for the IMAP + search command - Fixed a bug in the SMTP DATA command that was sending an extra CRLF which violates the SMTP RFC - Added some classes and ids to the message control submit buttons to Modified: trunk/hastymail2/hastymail2.conf.example =================================================================== --- trunk/hastymail2/hastymail2.conf.example 2008-12-28 02:08:19 UTC (rev 680) +++ trunk/hastymail2/hastymail2.conf.example 2008-12-28 22:18:44 UTC (rev 681) @@ -182,7 +182,16 @@ imap_disable_sort_speedup = false + # imap_search_charset + # ------------------- + # IMAP search commands can contain an optional charset. If you have problems + # with the search page or the filters plugin changing this might help. + # Available options are utf-8, ascii, or you can leave this blank to + # omit the charset option from searches completely. +imap_search_charset = utf-8 + + # ALTERNATE IMAP SERVER SETTINGS # ------------------------------------------------------------------------ # Hastymail can support logging into multiple IMAP acccounts using the following Modified: trunk/hastymail2/index.php =================================================================== --- trunk/hastymail2/index.php 2008-12-28 02:08:19 UTC (rev 680) +++ trunk/hastymail2/index.php 2008-12-28 22:18:44 UTC (rev 681) @@ -157,6 +157,12 @@ 'FROM' => 283, 'R_FROM' => 284, 'SUBJECT' => 285, 'R_SUBJECT' => 286, ); +/* IMAP SEARCH CHARSET options */ +$imap_search_charsets = array( + 'utf-8' => 'CHARSET UTF-8', + 'ascii' => 'CHARSET US-ASCII', + '' => '' +); /* ajax function names */ $ajax_functions = array( Modified: trunk/hastymail2/lib/imap_class.php =================================================================== --- trunk/hastymail2/lib/imap_class.php 2008-12-28 02:08:19 UTC (rev 680) +++ trunk/hastymail2/lib/imap_class.php 2008-12-28 22:18:44 UTC (rev 681) @@ -610,6 +610,7 @@ var $delimiter; var $use_folder_cache; var $short_responses; + var $search_charset; var $use_uid_cache; var $use_header_cache; var $state; @@ -620,6 +621,7 @@ function imap() { $this->debug = array(); $this->server = '127.0.0.1'; + $this->search_charset = 'utf-8'; $this->port = 143; $this->delimiter = false; $this->ssl = false; @@ -1844,7 +1846,14 @@ } } function full_search($terms) { - $command = 'UID SEARCH CHARSET UTF-8 '.$terms."\r\n"; + global $imap_search_charsets; + if (isset($imap_search_charsets[$this->search_charset])) { + $charset = $imap_search_charsets[$this->search_charset].' '; + } + else { + $charset = ''; + } + $command = 'UID SEARCH '.$charset.$terms."\r\n"; $this->send_command($command); $result = $this->get_response(false, true); $status = $this->check_response($result, true); @@ -1881,13 +1890,20 @@ } } function simple_search($fld, $uids, $term) { + global $imap_search_charsets; if (!empty($uids)) { $uids = 'UID '.implode(',', $uids); } else { $uids = 'ALL'; } - $command = 'UID SEARCH CHARSET UTF-8 '.$uids.' '.$fld.' "'.str_replace('"', '\"', $term)."\"\r\n"; + if (isset($imap_search_charsets[$this->search_charset])) { + $charset = $imap_search_charsets[$this->search_charset].' '; + } + else { + $charset = ''; + } + $command = 'UID SEARCH '.$charset.$uids.' '.$fld.' "'.str_replace('"', '\"', $term)."\"\r\n"; $this->send_command($command); $result = $this->get_response(false, true); $status = $this->check_response($result, true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |