From: Kevin McCarthy Date: Sat, 9 Jul 2016 01:47:57 +0000 (-0700) Subject: Don't overwrite imap_status->uidnext with a lower value. (closes #3771) X-Git-Tag: neomutt-20160822~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9f52d9fcd5fac20dbcd977d4007239af511d263;p=neomutt 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. --- diff --git a/imap/message.c b/imap/message.c index c8962e1af..088278084 100644 --- a/imap/message.c +++ b/imap/message.c @@ -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,