Skip to content

Commit b5a30f0

Browse files
gahrflatcap
authored andcommitted
Fix counting new mails in maildir
We only want to change msg_new if we're gathering stats. If we are only checking whether the mailbox has any new messages, we'll stop at the first new message we encounter, so msg_new would always be 1. Fixes #3843
1 parent f478297 commit b5a30f0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

maildir/maildir.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,14 @@ static void maildir_check_dir(struct Mailbox *m, const char *dir_name,
149149
}
150150
}
151151
m->has_new = true;
152-
check_new = false;
153-
m->msg_new++;
154-
if (!check_stats)
152+
if (check_stats)
153+
{
154+
m->msg_new++;
155+
}
156+
else
157+
{
155158
break;
159+
}
156160
}
157161
}
158162
}
@@ -1354,10 +1358,10 @@ static enum MxStatus maildir_mbox_check_stats(struct Mailbox *m, uint8_t flags)
13541358
{
13551359
bool check_stats = flags & MUTT_MAILBOX_CHECK_FORCE_STATS;
13561360
bool check_new = true;
1357-
m->msg_new = 0;
13581361

13591362
if (check_stats)
13601363
{
1364+
m->msg_new = 0;
13611365
m->msg_count = 0;
13621366
m->msg_unread = 0;
13631367
m->msg_flagged = 0;

0 commit comments

Comments
 (0)