changeset: 6718:4dc1831fd6d7
user:      Kevin McCarthy <[email protected]>
date:      Fri Jul 08 18:47:57 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/4dc1831fd6d7

Don't overwrite imap_status->uidnext with a lower value.  (closes #3771)

imap_read_headers() updates the idata and imap_status uidnext after
reading through all the new headers.

The idata is updated properly (only if its uidnext is below maxuid+1),
but the imap_status was always being set to maxuid.

This causes a problem with new mail checking if the most recent
messages are deleted.  Then the uidnext will be greater than maxuid+1
in the mailbox, and if there are any other unread messages it will
*always* report new mail even if $mail_check_recent is set.

diffs (15 lines):

diff -r 6f2fe8f32dab -r 4dc1831fd6d7 imap/message.c
--- a/imap/message.c    Thu Jul 07 12:00:37 2016 -0700
+++ b/imap/message.c    Fri Jul 08 18:47:57 2016 -0700
@@ -354,8 +354,9 @@
     }
   }
 
-  if (maxuid && (status = imap_mboxcache_get (idata, idata->mailbox, 0)))
-  status->uidnext = maxuid + 1;
+  if (maxuid && (status = imap_mboxcache_get (idata, idata->mailbox, 0)) &&
+      (status->uidnext < maxuid + 1))
+    status->uidnext = maxuid + 1;
 
 #if USE_HCACHE
   mutt_hcache_store_raw (idata->hcache, "/UIDVALIDITY", &idata->uid_validity,

Reply via email to