I'm not using "elt->private.msg.env". I just want to be able to get the response that IMAP server returned from the fast command.

I have no choice but to download all the message headers but I want to get them all at once with one request and many responses which will be much faster than 15,000 requests and 15,000 responses.

But what I'm trying to do is get all the message header (no bodies) to be able to display the list of messages in a folder. Blame MS for the bad implementation of how Outlook work. ;)

Shawn

Mark Crispin wrote:

On Wed, 8 Sep 2004, Shawn Walker wrote:

What I want to do is get the list of messages back with all the info with one call and the loop through all the messages that came back. Not make 15,000 requests to server for 15,000 messages.


You *must* call mail_fetch_structure() to get the envelope.

If your application is using something like elt->private.msg.env, fix it *now* so that it does not do that; otherwise I guarantee that it will break in the future.

mail_fetch_structure() does not necessarily send a request to the server. If the envelope is in the cache, it will return the cached value. There is a cache lookahead (that defaults to 20) which will fill the cache up to that number of messages ahead of the message you requested on a cache miss.

If you really want to lookahead for all messages, then do:
  mail_parameters (NIL,SET_LOOKAHEAD,(void *) LONG_MAX);
prior to your mail_fetch_structure() call.

I don't recommend doing that. Envelopes are not part of the fast data, and there is no particular reason to believe that doing
tag FETCH 1:15000 ENVELOPE
will complete in anything approaching a reasonable timeframe.


Good quality IMAP applications do not generally do a "download all messages" operation. Instead, they only fetch data as needed. Most users do not have screens that can display 15,000 messages at once, and most display toolkits allow for a "draw line method" in a scrolling view (which can in turn call mail_fetch_structure()) rather than requiring that the entire scrolled text be loaded at once. Similarly, most program-related processing of envelope data can be done via the SEARCH, SORT, and THREAD operations.

-- Mark --

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



Reply via email to