X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=buffy.c;h=24663cbab2cc3c27d491c506dc77b1168792e713;hp=1f49f9113554b6b05ab83319099838ea2472d0c3;hb=1ba8fe51b392da2018cdf535389ae5a21f99ce27;hpb=b2a6a9673e124c222f921650a6f0025b64ab2145 diff --git a/buffy.c b/buffy.c index 1f49f91..24663cb 100644 --- a/buffy.c +++ b/buffy.c @@ -271,7 +271,7 @@ int mutt_buffy_check (int force) struct stat contex_sb; time_t now, last1; CONTEXT *ctx; - int i = 0, local = 0; + int i = 0, local = 0, count = 0; #ifdef USE_IMAP time_t last2; @@ -303,7 +303,10 @@ int mutt_buffy_check (int force) BuffyCount = 0; BuffyNotify = 0; - if ((!Context || mx_is_local (Context->magic-1)) && stat (Context->path, &contex_sb) != 0) { + count = sidebar_need_count (); + + if (!Context || !Context->path || + (mx_is_local (Context->magic-1) && stat (Context->path, &contex_sb) != 0)) { /* check device ID and serial number instead of comparing paths */ contex_sb.st_dev = 0; contex_sb.st_ino = 0; @@ -334,7 +337,7 @@ int mutt_buffy_check (int force) case M_MMDF: /* only check on force or $mail_check reached */ if (force != 0 || (now - last1 >= BuffyTimeout)) { - if (SidebarWidth == 0 || !option (OPTMBOXPANE)) { + if (!count) { if (STAT_CHECK) { BuffyCount++; tmp->new = 1; @@ -346,8 +349,7 @@ int mutt_buffy_check (int force) } #endif } - else if (SidebarWidth > 0 && option (OPTMBOXPANE) && - (STAT_CHECK || tmp->msgcount == 0)) { + else if (STAT_CHECK || tmp->msgcount == 0) { /* sidebar visible */ BuffyCount++; if ((ctx = @@ -388,7 +390,7 @@ int mutt_buffy_check (int force) if (tmp->new == 0) { BuffyCount++; tmp->new = 1; - if (SidebarWidth == 0 || !option (OPTMBOXPANE)) + if (!count) /* if sidebar invisible -> done */ break; } @@ -399,7 +401,7 @@ int mutt_buffy_check (int force) } closedir (dirp); - if (SidebarWidth > 0 && option (OPTMBOXPANE)) { + if (count) { /* only count total mail if sidebar visible */ snprintf (path, sizeof (path), "%s/cur", tmp->path); if ((dirp = opendir (path)) == NULL) { @@ -431,7 +433,7 @@ int mutt_buffy_check (int force) if (force != 0 || (now - last1 >= BuffyTimeout)) { if ((tmp->new = mh_buffy (tmp->path)) > 0) BuffyCount++; - if (SidebarWidth > 0 && option (OPTMBOXPANE)) { + if (count) { DIR *dp; struct dirent *de;