MBOX-Line: From MRC at CAC.Washington.EDU  Mon Mar 12 16:45:56 2007
To: imap-protocol@u.washington.edu
From: Mark Crispin <MRC@CAC.Washington.EDU>
Date: Fri Jun  8 12:34:38 2018
Subject: [Imap-protocol] SEARCH restricted to one mailbox?  Extensions?
In-Reply-To: <07Mar12.152936pst."57996"@synergy1.parc.xerox.com>
References: <07Mar12.152936pst."57996"@synergy1.parc.xerox.com>
Message-ID: <alpine.WNT.0.83.0703121637220.7904@Tomobiki-Cho.CAC.Washington.EDU>

On Mon, 12 Mar 2007, Bill Janssen wrote:
> I basically want to be able to do searches across my entire mail
> database, instead of just folder-by-folder, and I'm wondering how to
> plaster that into the protocol.

There is an unpublished extension, implemented by UW imapd, called SCAN 
which is a LIST with a third argument that consists of text to be looked 
up in the mailbox, and which acts as a filter on the LIST results.  Only 
the mailboxes which contain that text are returned in untagged LIST 
responses.

However, SCAN is a disgusting hack that was done to create the equivalent 
of "greping through mail files" since there were oldtimers who refused to 
use IMAP unless they could "grep over IMAP" (actually, "fgrep" since they 
didn't actually use regular expressions and neither does SCAN).

The problem with SCAN is that, like [f]grep, it makes no distinction 
between mailbox metadata and message data.  Thus, the command
 	tag SCAN "" % "mbx"
will match all mailboxes on a system which uses mbx-format as the mail 
store, since every mbx-format mailbox starts with "*mbx*".

A much better thing to do would be to implement to corresponding 
functionality in LISTEXT.

-- Mark --

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

