[Tickets #8922] Re: Sort messages by arrival date not working correctly

bugs at horde.org bugs at horde.org
Mon Mar 22 09:22:08 UTC 2010


Ticket URL: http://bugs.horde.org/ticket/8922
  Ticket             | 8922
  Updated By         | Valentin.Vidic at CARNet.hr
  Summary            | Sort messages by arrival date not working correctly
  Queue              | IMP
  Version            | 4.3.6
  Type               | Bug
  State              | Not A Bug
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |

Valentin.Vidic at CARNet.hr (2010-03-22 05:22) wrote:

On Fri, Mar 19, 2010 at 12:46:25PM -0400, bugs at horde.org wrote:
> Yes.  ARRIVAL SORT = message sequence number.  This statement is
> nothing more than providing a keyword to use for SORT to do the same
> thing as a regular arrival sort.

We use cyrus here and it implements ARRIVAL SORT by comparing internal
dates from the mailbox index (no need to read header of every message).
It also implements a SEQUENCE SORT that uses just message numbers:

         switch (sortcrit[i].key) {
         case SORT_SEQUENCE:
             ret = numcmp(md1->msgno, md2->msgno);
         case SORT_ARRIVAL:
             ret = numcmp(INTERNALDATE(md1->msgno), INTERNALDATE(md2->msgno));

> Unfortunately, you are assuming a lot of things about IMAP servers.
> First, the SORT extension wasn't standardized until June *2008*.  So
> there can be no assumption that the IMAP server supports SORT (not
> to mention IMP 4 was first released 5-6 years ago, before SORT
> existed on most IMAP servers).
> Second, many IMAP servers don't support SORT.  It's not required of
> an IMAP 4rev1 server.  Thus, to sort by anything other than internal
> arrival time requires the IMAP server to parse *EVERY* header of
> *EVERY* message in the mailbox (a MUA can use FETCH to only return
> the text of the desired header, but this still requires the IMAP
> server to internally parse every header to collate this
> information).
> Third, even for IMAP servers that support SORT, there is no
> guarantee that SORT is inexpensive.  Many IMAP servers may not cache
> this information, so every SORT call to the server requires parsing
> of the entire mailbox.

Ok, but for those of use using servers like cyrus, perhaps there could
at least be a configuration option to select between _arrival cache

More information about the bugs mailing list