]> granicus.if.org Git - neomutt/commitdiff
Don't overwrite imap_status->uidnext with a lower value. (closes #3771)
authorKevin McCarthy <kevin@8t8.us>
Sat, 9 Jul 2016 01:47:57 +0000 (18:47 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 9 Jul 2016 01:47:57 +0000 (18:47 -0700)
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.

imap/message.c

index c8962e1af2af0d037fadd6a643cdb0a95a1df690..0882780840866ecb50b781ebc875a0ae0eb7b7f6 100644 (file)
@@ -354,8 +354,9 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
     }
   }
 
-  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,