[imapfilter-devel]Filter generation

Lefteris Chatzibarbas lefcha at hellug.gr
Wed Oct 30 19:38:05 EET 2002


On Mon, Oct 28, 2002 at 04:56:03PM +0100, Mario Strasser wrote:
> Hi,
> 
> Our Windows 2000 Exchange mail server at the University 
> seems to have troubles with the filter roules generated by imapfilter 
> if they include more than 2 items. For example
> SEARCH (OR X Y) works whereas SEARCH (OR X Y Z) does not.

What does the server reply to the SEARCH requests? BAD? OK?


A mail server with Microsoft Exchange 2000 at my university works fine:

  * OK Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0
  (diamond.itc.auth.gr) ready.
  
  ...
  
  debug: sending command: F00006 SEARCH ALL SEEN OR (TO "foo") OR (SUBJECT
  "123456") (SINCE 22-Jul-2002) OR (SMALLER 100000) OR (FROM "corge") (CC
  "thud")
  
  * SEARCH 1 2 3 4 5 6 7 8 9 10 11 15
  F00006 OK SEARCH completed.
  
  ...
  
  debug: sending command: F00007 SEARCH OR (TO "foo" SUBJECT "123456" SINCE
  22-Jul-2002) OR (LARGER 100000) (FROM "corge" CC "thud")
  
  * SEARCH  12 13 14
  F00007 OK SEARCH completed.
  
  ...
  
  * BYE Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 signing
  off.
  F00009 OK LOGOUT completed.

> 
> In RFC 2060 section 6.4.4 the OR command is defined as
> OR <search-key1> <search-key2>
> thus I had to modify the generate_filter_or() function in such a way
> that it adds extra brackets and brings the filter to the needed form: 
> SEARCH (OR X (OR Y Z)).

Note that, this is not the same with (OR X Y Æ) that you mentioned before:

  (OR X Y Æ)       -->  (X or Y) and Z
  (OR X (OR Y Z))  -->  X or Y or Z


I don't think that RFC2060 states that parentheses are needed in forms
like the aforementioned.  This means that "SEARCH OR X OR Y Z",
"SEARCH (OR X (OR Y Z))", "SEARCH (OR X OR Y Z)", "SEARCH OR (X) OR (Y) (Z)",
"SEARCH OR (X) (OR (Y) (Z))", etc. are correct and must return the same
result.

> [...]




More information about the Imapfilter-devel mailing list