- if (tmp->newly_created &&
- (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
- tmp->newly_created = 0;
- }
- break;
+ } else if (SidebarWidth > 0 && option (OPTMBOXPANE) &&
+ (STAT_CHECK || tmp->msgcount == 0)) {
+ /* sidebar visible */
+ int msg_count = 0, msg_unread = 0, msg_new = 0;
+ BuffyCount++;
+ if ((ctx = mx_open_mailbox (tmp->path, M_READONLY | M_QUIET | M_NOSORT, NULL)) != NULL) {
+ msg_count = ctx->msgcount;
+ msg_unread = ctx->unread;
+ msg_new = ctx->new;
+ mx_close_mailbox (ctx, 0);
+ }
+ tmp->msgcount = msg_count;
+ tmp->msg_unread = msg_unread;
+ tmp->new = msg_new;
+ tmp->has_new = msg_new > 0;
+ }
+ if (tmp->newly_created &&
+ (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
+ tmp->newly_created = 0;
+ break;