IMAP->message_index has inconsistent return type
|Reported by:||ziba||Owned by:|
IMAP->message_index has an inconsistent return type which can cause wrong message navigation values when viewing a single message and improper header listings.
There are two places that call $IMAP->message_index()
First is in program/steps/mail/show.inc when listing headers in a large folder on a server without sorting capability. It expects message_index() to return a list of ids.
The second is in program/include/rcube_imap.php:679 when determining the values for rcmcountdisplay. It expects message_index() to return a list of uids.
What message_index actually returns is dependent on the weather
it returns an array of ids if:
- the message cache is bad or empty and the server has sorting capability
- we're viewing a page of search results and the server has sorting capability
it returns an array of uids if:
- the message cache is good
it returns an array of the current sort_field if:
- the message cache is bad and the server does not have sorting capability
- we're viewing a page of search results and the server does not have sorting capability
Returning the current sort_field is due to a possible misuse of
iil_C_FetchHeaderIndex($this->conn, $mailbox, "1:$msg_count", $this->sort_field).
The fourth argument is not for sorting, its what will be returned.
Should $IMAP->message_index be changed to always return uids or ids?
Sorry if I'm misunderstanding something. Thanks for looking into this.