-
Kevin J. McCarthy authored
Ticket 3942 revealed that it is possible for a FETCH to have gaps in the MSN numbers of the results. The code makes many assumptions that equate context index counts and MSN. This is the first in a series of commits fixing that assumption. The header->index field is supposed to hold the SORT_ORDER index number of the message. If there are gaps in the MSN, than the highext MSN can in fact be out of the range 0..ctx->msgcount-1. After studying the code, I believe curs_main.c would actually work with header->index values out of the range, at least for IMAP. But some other parts of the code, such as mutt_reopen_mailbox(), do rely on the values being a valid index to ctx->hdrs[]. And the intertwining of menu->oldcurrent with header->index values makes me nervous about future changes. So, to be safe, move the MSN to its own field in IMAP_HEADER_DATA. The next commit will fix the EXPUNGE behavior.
95c6d067