More fixes for out-of-order FETCH responses.
authorBrendan Cully <brendan@kublai.com>
Thu, 10 Aug 2006 00:06:32 +0000 (00:06 +0000)
committerBrendan Cully <brendan@kublai.com>
Thu, 10 Aug 2006 00:06:32 +0000 (00:06 +0000)
imap/command.c
imap/message.c

index 2ec3fc6077875ae4255f9f317f7a961e4198d5fa..f3fbb07134c1730c6f23542433ebbc53977b58ea 100644 (file)
@@ -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;
index 2495479ee8a1fc8b0e4eb382b71cc892e4d2bc31..6c3425a37b4f8c1b2693d22ce899eb4e19d5ec75 100644 (file)
@@ -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++;