[Imap-protocol] cancel or limit results from imap search
mrc+imap at panda.com
Thu Apr 14 19:04:28 PDT 2011
On Thu, 14 Apr 2011, Brendan Miller wrote:
> Is there a way in the imap protocol to limit the number of results
> from a search command?
You can compose your search criteria to limit the range of messages that
are searched by either message sequence number or UID, and by doing so put
a cap on the number of messages returned.
There is an extension that returns "first n results"; but that extension
is not widely implemented.
> Would the only way to do this be to disconnect
> the tcp stream after having received the number of results you want?
Since search results come back in a single response, it is pointless to do
> As a follow up question, in the c-client, is there a means of safely
> disconnecting a mailstream in the mm_searched callback? The
> documentation seemed to indicate that calling back into the c-client,
> say to do a mail_close, is not safe within mm_* callbacks.
The simple answer is "no".
IMAP is not HTTP. IMAP is a stateful protocol. Disconnecting is
antihetical to state architectures.
Please use IMAP properly. The market is saturated with poorly designed
and poor performing IMAP client implementations. Don't add to them.
If you enjoy banging your head against a wall repeatedly in frustration
as your application never works work a damn, then ignore my advice.
-- Mark --
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
More information about the Imap-protocol