[imp] Search Messages

Fabio Lourenco Gomes flgomes@fazenda.sp.gov.br
Mon, 08 Apr 2002 17:37:29 +0000


Hiya and Jan,

	Yeah. I have seen the mailbox.php code and found the code who makes the 
search. A piece follows:

--
301: if (!empty($HTTP_POST_VARS['search_subject']))
302:         $query .= ' FROM "' . Horde::getFormData('search_subject') 
. '"';
--

	Aham. As you said Jan, double quotes are added around the search string. 
But something weird still happening...
	When I want to search messages with the subject equals to "foo foo" the 
IMAP command sent to my Courier server is:

--
00000001 UID SORT (ARRIVAL) US-ASCII ALL SUBJECT "foo foo"
--

	Look. The quotes was added like the mailbox.php code said.
	But I want now to search for a subject equals to "foo" and the IMAP 
command sent to my IMAP server is:

--
00000001 UID SORT (ARRIVAL) US-ASCII ALL SUBJECT foo
--

	Strange... At this time the quotes are missing. But the IMAP result is 
successfuly and IMP shows me the messages found with no errors.

	But the problem appears when I want to search for a number. Lets try the 
number 2:

--
00000001 UID SORT (ARRIVAL) US-ASCII ALL SUBJECT 2
--

	Ok. The IMAP command was sent like it was sent to search "foo". But the 
server response is diferent:

--
00000001 NO error in IMAP command received by server.
--

	And IMP says:

--
Warning: Error in IMAP command received by server. (errflg=2) in Unknown 
on line 0
--

	When I try this search by hand, 'telneting' my IMAP server and 
surrounding the number 2 with quotes, the result is successfuly.

	But the problem is:
	Where's the quotes in the "foo" and "2" strings sent by IMP?
	Could it be a PHP bug or feature (my php: php-4.1.2)?

	I really need a solution. I have tried some codes workarounds, but they 
were disappointing... :-(

	TYA,
	Fábio Gomes



Jan Schneider wrote:
> Zitat von Fabio Lourenco Gomes <flgomes@fazenda.sp.gov.br>:
> 
> 
>>Hiya,
>>
>>	There's a 'bug' or something at searching messages in IMP (SEARCH 
>>option). If I supply a number in Subject, To, Cc, Bcc, From, Body fields
>>
>>I recieve the following Warning:
>>
>>'Warning: Error in IMAP command received by server. (errflg=2) in 
>>Unknown on line 0'
>>
>>	I 'sniffed' the IMAP server port and the command sent by IMP was:
>>
>>'00000001 UID SORT (ARRIVAL) US-ASCII ALL SUBJECT 2'
>>
>>	I think we need quotes around the number, search criteria ('2') to 
>>workaround this.
>>
>>	I have tried to find in IMP the code where's this search function, 
> 
> but I
> 
>>couldn't... :-(
>>
>>	That problem was already mentioned?
>>	Are there any patch?
>>	Am I right?
>>	In which part of the code can I find the search code to correct 
> 
> this?
> 
> The search query is build in mailbox.php. And as you can see there we 
> already put quotes around the search strings. The error must be somewhere 
> else.
> 
> Jan.
> 
> --
> http://www.horde.org - The Horde Project
> http://www.ammma.de - discover your knowledge
> http://www.tip4all.de - Deine private Tippgemeinschaft
> 



-- 
@_{2**2..6*6}=split//,"áiGsDDbooe  eoin m-IsvveoF Tenlmt";print 
values%_,"\n"