On Thu, 21 Nov 2002, Oliver Schulze L. wrote:
> - "IMAP4 search string": a char string that a IMAP4 server can understand
>    when you send it via telnet (i.e. telnet localhost imap).

As I explained earlier, IMAP search commands are much more complex than a
single string.  So, what you are calling an "IMAP search string" is a
char* subset of what can be sent to an IMAP server, and thus a *third*
representation of searching: IMAP search command, SEARCHPGM, and this new
subset string which expresses some but not all IMAP4 searches.

> 1. The user search this human search string:
>      "messages which are flagged, or are from SMITH and cc JONES"
> 2. The PHP programer, in the PHP program, somehow translates this human
>     search string into an IMAP4 search string. The result string is:
>      "FLAGGED OR FROM SMITH CC JONES"

You just proved one of my points.  That is not the correct translation.

Human "messages which are flagged, or are from SMITH and cc JONES" is
        OR FLAGGED (FROM SMITH CC JONES)
in IMAP.

Conversely, IMAP
        FLAGGED OR FROM SMITH CC JONES
is human "messages which are flagged, and are:
 1) from smith
or
 2) cc jones
or
 3) from smith and cc jones".

Now, if you want human "messages which are flagged, or are either from
SMITH or cc JONES", then you want
        OR FLAGGED OR FROM SMITH CC JONES

Or perhaps you want "messages which are flagged, and are from SMITH or cc
JONES but not from SMITH and cc JONES" then you want
        FLAGGED OR FROM SMITH CC JONES NOT FROM SMITH CC JONES

I think that you're starting to see why IMAP search criteria, while very
logical, are absolutely not the sort of thing that you want to send to
humans.

> 3. The PHP programer use a PHP function to send this IMAP4 search
>      string to the server.
>      <?php imap_search("FLAGGED OR FROM SMITH CC JONES");?>

Why?  Why not send a SEARCHPGM, or something that more reasonably
translates into a SEARCHPGM?

> 5. the IMAP server undestand the IMAP4 search string

No, the IMAP server understands an IMAP4 SEARCH command, which is sent
from a SEARCHPGM, which is totally different from what you're calling an
"IMAP4 search string" even if there are similarities.

> Since every c-client user(programer) must do a custom parsing of a IMAP4
> search string into a SEARCHPGM

I am suggesting, once again, that if a C programmer is dealing with "IMAP4
search strings" he's going about it the wrong way.  Such strings are never
sent to the server.  What is sent to the server is generated by the
c-client library, and can easily be a very interactive process resulting
in multiple transmit/response operations.

Why can't PHP deal with SEARCHPGMs?  That *is* the IMAP4 search criteria.

If I could have used a char* string I wouldn't have created SEARCHPGM.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.

Reply via email to