Squirrelmail 1.4.21 imap_search.php search results sorted by date jasonklein 20130115
If SM is configured to use IMAP server-side sorting ($allow_server_sort == 1), this patch will use IMAP SORT extensions to sort search results by REVERSE DATE order. This will sort messages by date, displaying messages with newest dates first.
If SM is NOT configured to use IMAP server-side sorting, this patch will reverse sort the array of message ids returned by IMAP SEARCH. This will sort messages by the IMAP server's internal index sequence, generally displaying messages most recently added to IMAP mailbox first.
Default SM behavior uses IMAP SEARCH (instead of IMAP SORT) to search for messages and displays unsorted search results. Search results may appear to be sorted by date, displaying messages with oldest dates first. This is only because the IMAP server search results are listed in the same order that the messages were added to the IMAP mailbox. If messages with various Date: headers are copied to the IMAP server via an IMAP client, SM search results will NOT be sorted by date.
Tested with SM 1.4.21 (Debian Squeeze 6.0.6, Apache 2.2.16, PHP 5.3.3) and remote IMAP server running Dovecot 1.2.15 (Debian Squeeze 6.0.6).
Please consider incorporating this patch (or similar changes) into SM. You may license via GPL.
Feature Requests - Sort Search Results - ID: 662406 (open)
Bugs - Sorting of messages - ID: 1530495 (closed, need more info)
[SM-USERS] How do I sort Search Results by descending date?
Internet Message Access Protocol - SORT and THREAD Extensions - RFC 5256
GNU Public License
Log in to post a comment.