--- buffy.c +++ buffy.c 2009-03-03 16:56:53.886429226 +0100 @@ -259,7 +259,7 @@ int mutt_buffy_check (int force) char path[_POSIX_PATH_MAX]; struct stat contex_sb; time_t t; - CONTEXT *ctx; + #ifdef USE_IMAP /* update postponed count as well, on force */ if (force) @@ -294,8 +294,6 @@ int mutt_buffy_check (int force) for (tmp = Incoming; tmp; tmp = tmp->next) { - if ( tmp->new == 1 ) - tmp->has_new = 1; #ifdef USE_IMAP if (tmp->magic != M_IMAP) #endif @@ -347,13 +345,18 @@ int mutt_buffy_check (int force) ) { + int check; + switch (tmp->magic) { case M_MBOX: case M_MMDF: - if (STAT_CHECK || tmp->msgcount == 0) + check = STAT_CHECK; + + if (option(OPTSIDEBAR) && (check || tmp->msgcount == 0)) { + CONTEXT *ctx; BUFFY b = *tmp; int msgcount = 0; int msg_unread = 0; @@ -368,11 +371,11 @@ int mutt_buffy_check (int force) *tmp = b; tmp->msgcount = msgcount; tmp->msg_unread = msg_unread; - if (STAT_CHECK) + } + if (check) { - tmp->has_new = tmp->new = 1; BuffyCount++; - } + tmp->new = 1; } else if (option(OPTCHECKMBOXSIZE)) { @@ -403,7 +406,13 @@ int mutt_buffy_check (int force) if (*de->d_name != '.' && (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T'))) { - tmp->has_new = tmp->new = 1; + if (!option(OPTSIDEBAR)) + { + BuffyCount++; + tmp->new = 1; + break; + } + tmp->new = 1; tmp->msgcount++; tmp->msg_unread++; } @@ -413,6 +422,9 @@ int mutt_buffy_check (int force) closedir (dirp); + if (!option(OPTSIDEBAR)) + break; + /* * count read messages (for folderlist (sidebar) we also need to count * messages in cur so that we the total number of messages @@ -430,8 +442,7 @@ int mutt_buffy_check (int force) (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T'))) { tmp->msgcount++; - if (p && strchr(p + 3, 'F')) - { + if (p && strchr(p + 3, 'F')) { tmp->msg_flagged++; } } @@ -440,26 +451,25 @@ int mutt_buffy_check (int force) break; case M_MH: + if ((tmp->new = mh_buffy (tmp->path)) > 0) - { - DIR *dp; - struct dirent *de; - if ((tmp->new = mh_buffy (tmp->path)) > 0) BuffyCount++; + if (!option(OPTSIDEBAR)) + break; - if ((dp = opendir (path)) == NULL) - break; - tmp->msgcount = 0; - while ((de = readdir (dp))) + if ((dirp = opendir (path)) == NULL) + break; + tmp->msgcount = 0; + while ((de = readdir (dirp))) + { + if (mh_valid_message (de->d_name)) { - if (mh_valid_message (de->d_name)) - { - tmp->msgcount++; - tmp->has_new = tmp->new = 1; - } + tmp->msgcount++; + tmp->new = 1; } - closedir (dp); } + closedir (dirp); + break; } } --- buffy.h +++ buffy.h 2009-03-03 16:47:06.444002194 +0100 @@ -27,7 +27,6 @@ typedef struct buffy_t struct buffy_t *next; struct buffy_t *prev; short new; /* mailbox has new mail */ - short has_new; /* set it new if new and not read */ int msgcount; /* total number of messages */ int msg_unread; /* number of unread messages */ int msg_flagged; /* number of flagged messages */