David Harris <[EMAIL PROTECTED]>
> This is fine in theory, but how do you handle sorting?

I keep my client-side data sorted appropriately. When the server tells me
something, I insert it into my clientside data structures and remind
myself to update my display.

If I discover that UID 12444 doesn't exist any more, I get rid of my
cached copy.

If I discover that UID 14002 newly exists, I ask the server for a little
information about the new message, so that I can display it appropriately.
(In my case that'll usually be "uid fetch 14002 body header.fields(...)".)

> I don't think it's 
> unreasonable for the user to expect to see the mailbox in a sort order of 
> his or her choosing, but the core IMAP protocol provides no means for 
> doing this (unless it's been added in the latest draft and I missed it) - the 
> connected client has to retrieve at the minimum the sorting field for 
> every message in the folder.

Not at all. The client has to:

 1. Find out which messages have been deleted since last time it looked.
 2. Find out which messages have been added since last time it looked.
 3. Fetch sufficient information about the added messages to display them
    appropriately.

If you do no caching at all, want to sort messages by date and display all
the messages, then yes, you have to do someting like "FETCH 1:* blah".

Personally, I cache as much information as I can and don't sort the entire
mailbox before I display. I do sort what I display, though.

> I know there was a proposed sorting extension, but I never found a copy 
> of the specification (granted I didn't look especially hard), and even if I 
> had, I'd still have had to code for the typical case of servers that didn't 
> support it.

draft-ietf-imapext-sort-09.txt

> Am I missing something here? I don't see how you can do lazy fetching 
> on a sorted mailbox unless the sorting can be done on the server side, 
> and the mathematical properties of both sequence numbers and UIDs 
> appear to make that impossible.

It may be impossible, but with a little sleight of hand you can imitate it
convincingly ;)

--Arnt

Reply via email to