From: Brendan Cully Date: Thu, 10 Aug 2006 00:06:32 +0000 (+0000) Subject: More fixes for out-of-order FETCH responses. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79ab34a2584f050e18147e7b25f52acdf105863b;p=neomutt More fixes for out-of-order FETCH responses. --- diff --git a/imap/command.c b/imap/command.c index 2ec3fc607..f3fbb0713 100644 --- a/imap/command.c +++ b/imap/command.c @@ -537,7 +537,7 @@ static void cmd_parse_fetch (IMAP_DATA* idata, char* s) { h = idata->ctx->hdrs[cur]; - if (h->active && h->index+1 == msgno) + if (h && h->active && h->index+1 == msgno) { dprint (2, (debugfile, "Message UID %d updated\n", HEADER_DATA(h)->uid)); break; diff --git a/imap/message.c b/imap/message.c index 2495479ee..6c3425a37 100644 --- a/imap/message.c +++ b/imap/message.c @@ -250,7 +250,6 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) imap_cmd_start (idata, buf); } - /* freshen fp, h */ rewind (fp); memset (&h, 0, sizeof (h)); h.data = safe_calloc (1, sizeof (IMAP_HEADER_DATA)); @@ -276,17 +275,9 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) fputs ("\n\n", fp); idx = h.sid - 1; - if (idx != msgno) - { - dprint (1, (debugfile, "Ignoring out-of-order FETCH response\n")); - continue; - } - /* update context with message header */ ctx->hdrs[idx] = mutt_new_header (); ctx->hdrs[idx]->index = h.sid - 1; - if (h.sid != ctx->msgcount + 1) - dprint (1, (debugfile, "imap_read_headers: msgcount and sequence ID are inconsistent!")); /* messages which have not been expunged are ACTIVE (borrowed from mh * folders) */ ctx->hdrs[idx]->active = 1; @@ -305,14 +296,14 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) rewind (fp); /* NOTE: if Date: header is missing, mutt_read_rfc822_header depends * on h.received being set */ - ctx->hdrs[msgno]->env = mutt_read_rfc822_header (fp, ctx->hdrs[msgno], + ctx->hdrs[idx]->env = mutt_read_rfc822_header (fp, ctx->hdrs[idx], 0, 0); /* content built as a side-effect of mutt_read_rfc822_header */ - ctx->hdrs[msgno]->content->length = h.content_length; + ctx->hdrs[idx]->content->length = h.content_length; #if USE_HCACHE sprintf(uid_buf, "/%u", h.data->uid); - mutt_hcache_store(hc, uid_buf, ctx->hdrs[msgno], idata->uid_validity, &imap_hcache_keylen); + mutt_hcache_store(hc, uid_buf, ctx->hdrs[idx], idata->uid_validity, &imap_hcache_keylen); #endif /* USE_HCACHE */ ctx->msgcount++;