From: Kevin McCarthy Date: Sun, 21 May 2017 01:52:14 +0000 (-0700) Subject: Fix cmd_parse_fetch() to match against MSN. (see #3942) X-Git-Tag: neomutt-20170707^2^2~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05157f6aec7555c18bcef3f19b1cba0884c0c21e;p=neomutt Fix cmd_parse_fetch() to match against MSN. (see #3942) --- diff --git a/imap/command.c b/imap/command.c index 249326c1e..71f4fd801 100644 --- a/imap/command.c +++ b/imap/command.c @@ -626,20 +626,22 @@ static void cmd_parse_expunge (IMAP_DATA* idata, const char* s) * Of course, a lot of code here duplicates code in message.c. */ static void cmd_parse_fetch (IMAP_DATA* idata, char* s) { - int msgno, cur; + unsigned int msn; + int cur; HEADER* h = NULL; dprint (3, (debugfile, "Handling FETCH\n")); - msgno = atoi (s); - - if (msgno <= idata->ctx->msgcount) + msn = atoi (s); + + /* TODO: this is wrong. Should compare to idata->max_msn, to be added. */ + if (msn <= idata->ctx->msgcount) /* see cmd_parse_expunge */ for (cur = 0; cur < idata->ctx->msgcount; cur++) { h = idata->ctx->hdrs[cur]; - if (h && h->active && h->index+1 == msgno) + if (h && h->active && HEADER_DATA(h)->msn == msn) { dprint (2, (debugfile, "Message UID %d updated\n", HEADER_DATA(h)->uid)); break;