[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mutt-dev
Subject:    mutt: Properly adjust fetch ranges when handling new mail. (see ...
From:       Brendan Cully <brendan () kublai ! com>
Date:       2017-05-21 17:55:18
Message-ID: hg.f87c679e508f.1495389318.1928362535899276112 () dev ! cs ! ubc ! ca
[Download RAW message or body]

changeset: 7052:f87c679e508f
user:      Kevin McCarthy <kevin@8t8.us>
date:      Sun May 21 10:51:38 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/f87c679e508f

Properly adjust fetch ranges when handling new mail. (see #3942)

When pulling down headers, it is possible for expunge responses to
happen too.  If we get a new mail count, we need to take into account
changes to the max_msn due to the expunges.

diffs (32 lines):

diff -r 77d3173aecff -r f87c679e508f imap/message.c
--- a/imap/message.c	Sat May 20 18:52:18 2017 -0700
+++ b/imap/message.c	Sun May 21 10:51:38 2017 -0700
@@ -325,7 +325,7 @@
         /* make sure we don't get remnants from older larger message headers */
         fputs ("\n\n", fp);
 
-        if (h.data->msn < msn_begin || h.data->msn > fetch_msn_end)
+        if (h.data->msn < 1 || h.data->msn > fetch_msn_end)
         {
           dprint (1, (debugfile, "imap_read_headers: skipping FETCH response for "
                       "unknown message number %d\n", h.data->msn));
@@ -392,10 +392,17 @@
       }
     }
 
-    /* in case we get new mail while fetching the headers */
+    /* In case we get new mail while fetching the headers.
+     *
+     * Note: it is possible to handle EXPUNGE responses while pulling
+     * down the headers.  Therefore, we need to use the current state
+     * of max_msn, not fetch_msn_end to set the start range.
+     */
     if (idata->reopen & IMAP_NEWMAIL_PENDING)
     {
-      msn_begin = fetch_msn_end + 1;
+      /* update to the last value we actually pulled down */
+      fetch_msn_end = idata->max_msn;
+      msn_begin = idata->max_msn + 1;
       msn_end = idata->newMailCount;
       while (msn_end > ctx->hdrmax)
         mx_alloc_memory (ctx);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic