- if (STAT_CHECK || tmp->msgcount == 0)
- {
- BUFFY b = *tmp;
- int msgcount = 0;
- int msg_unread = 0;
- BuffyCount++;
- /* parse the mailbox, to see how much mail there is */
- ctx = mx_open_mailbox( tmp->path, M_READONLY | M_QUIET | M_NOSORT,
- NULL);
- if(ctx)
- {
- msgcount = ctx->msgcount;
- msg_unread = ctx->unread;
- mx_close_mailbox(ctx, 0);
- }
- *tmp = b;
- tmp->msgcount = msgcount;
- tmp->msg_unread = msg_unread;
- if(STAT_CHECK)
- tmp->has_new = tmp->new = 1;
- }
+ if (STAT_CHECK || tmp->msgcount == 0)
+ {
+ BuffyCount++;
+ /* only do complete count if sidebar visible */
+ if (SidebarWidth > 0)
+ {
+ BUFFY b = *tmp;
+ int msgcount = 0;
+ int msg_unread = 0;
+ BuffyCount++;
+ /* parse the mailbox, to see how much mail there is */
+ ctx = mx_open_mailbox( tmp->path, M_READONLY | M_QUIET | M_NOSORT,
+ NULL);
+ if(ctx)
+ {
+ msgcount = ctx->msgcount;
+ msg_unread = ctx->unread;
+ mx_close_mailbox(ctx, 0);
+ }
+ *tmp = b;
+ tmp->msgcount = msgcount;
+ tmp->msg_unread = msg_unread;
+ if(STAT_CHECK)
+ tmp->has_new = tmp->new = 1;
+ }
+ else
+ {
+ /* sidebar invisible -> done */
+ tmp->new = 1;
+ }
+ }