changeset: 6743:4f4c258ab95c
user:      Richard Russon <[email protected]>
date:      Mon Jul 25 12:25:23 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/4f4c258ab95c

Fix imap buffy msg_count overwrite issue.

The sidebar updates the buffy->msg_count with the context.  This can
cause it to become out of sync with the imap_mboxcache.

If the imap_buffy doesn't request MESSAGES, don't overwrite the
buffy->msg_count with a stale value.

diffs (32 lines):

diff -r 7b9763564598 -r 4f4c258ab95c imap/command.c
--- a/imap/command.c    Fri Jul 22 14:55:01 2016 -0700
+++ b/imap/command.c    Mon Jul 25 12:25:23 2016 -0700
@@ -901,6 +901,7 @@
   unsigned int olduv, oldun;
   long litlen;
   short new = 0;
+  short new_msg_count = 0;
 
   mailbox = imap_next_word (s);
 
@@ -940,7 +941,10 @@
     count = strtol (value, &value, 10);
 
     if (!ascii_strncmp ("MESSAGES", s, 8))
+    {
       status->messages = count;
+      new_msg_count = 1;
+    }
     else if (!ascii_strncmp ("RECENT", s, 6))
       status->recent = count;
     else if (!ascii_strncmp ("UIDNEXT", s, 7))
@@ -1019,7 +1023,8 @@
           SidebarNeedsRedraw = 1;
 #endif
         inc->new = new;
-        inc->msg_count  = status->messages;
+        if (new_msg_count)
+          inc->msg_count = status->messages;
         inc->msg_unread = status->unseen;
 
        if (inc->new)

Reply via email to