mailing list archives

meli community discussions

⚠️ if something does not work as intended when interracting with the mailing lists,
reach out Github mirror Gitea repo @epilys:matrix.org

E-mail headers
From: Brendan Miller <catphive@catphive.net>
To: imap-protocol@u.washington.edu
Date: Fri, 08 Jun 2018 12:34:45 -0000
Message-ID: BANLkTi=JPaPQnuNtFWrwT+GUuuX0gC-wfg@mail.gmail.com permalink / raw / eml / mbox
Is there a way in the imap protocol to limit the number of results
from a search command? Would the only way to do this be to disconnect
the tcp stream after having received the number of results you want?

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.

Thanks,
Brendan
Reply
E-mail headers
From: mrc+imap@panda.com
To: imap-protocol@localhost
Date: Fri, 08 Jun 2018 12:34:45 -0000
Message-ID: alpine.OSX.2.00.1104141840530.797@hsinghsing.panda.com permalink / raw / eml / mbox
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
that.

> 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 --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
Reply