[horde] Imp message search problem -- bug report & patch

Daniel A. Ramaley daniel.ramaley at DRAKE.EDU
Tue Jan 10 13:20:47 PST 2006

As previously posted, i am setting up a webmail server with Imp 4.0.4 on
Horde 3.0.9. This server, once working, will replace our old server that
runs Imp 3.2.5 and Horde 2.1. The major problem right now is that
message searches in Imp always returns "No messages match your search"
even when manually checking reveals that their are indeed a number of
messages that should have matched a given search. The old server works
just fine, however. With the help of the mail server admin, i now know
what the problem is, but not yet how to best fix it.

We were able to log the imap conversation when Imp performs a search.
Here is the relevant part:

10-JAN-2006  12:55:56.98: IMAP thread: [8] received 56 bytes
00000006 UID SEARCH CHARSET UTF-8 FROM address at example.com..
10-JAN-2006  12:55:56.98: IMAP thread: [8] sent 33 bytes
00000006 NO unsupported charset.

The problem is the new version of Imp asks for a charset, while our imap
server does not support character sets, and Imp incorrectly interprets
the "NO" response to mean there were no search results. I didn't notice
an option in Imp's configuration to disable the charset attribute that
it sends, but below is a patch that fixes the problem. I think it is a
kludge, but it works well enough that we will be able to upgrade to Imp
4 now. If the Imp developers have a better way to do this for the next
version, that would be wonderful. Anyway, here's the patch:

--- lib/Horde/IMAP/Search.php~  2005-10-28 15:22:55.000000000 -0500
+++ lib/Horde/IMAP/Search.php   2006-01-10 15:04:04.000000000 -0600
@@ -159,12 +159,14 @@
     function _imapSearch(&$imap, $criteria)
-        if (!empty($this->_charset) &&
-            version_compare(phpversion(), '4.3.3', '>=')) {
-            return @imap_search($imap, $criteria, SE_UID, $this->_charset);
-        } else {
+/*        if (!empty($this->_charset) &&
+ *            version_compare(phpversion(), '4.3.3', '>=')) {
+ *            return @imap_search($imap, $criteria, SE_UID, $this->_charset);
+ *        } else {
+ */
             return @imap_search($imap, $criteria, SE_UID);
-        }
+/*        }
+ */

Dan Ramaley                            Dial Center 118, Drake University
Network Programmer/Analyst             2407 Carpenter Ave
+1 515 271-4540                        Des Moines IA 50311 USA

More information about the horde mailing list