From c5a9e16c0549dde89d106d82159183b31560fd34 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 25 Jul 2016 12:25:23 -0700 Subject: [PATCH] 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. --- imap/command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/imap/command.c b/imap/command.c index c91402422..4d34d2426 100644 --- a/imap/command.c +++ b/imap/command.c @@ -901,6 +901,7 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) unsigned int olduv, oldun; long litlen; short new = 0; + short new_msg_count = 0; mailbox = imap_next_word (s); @@ -940,7 +941,10 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) 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 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) 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) -- 2.40.0