diff -u mutt-1.3.28.orig/browser.c mutt-1.3.28/browser.c --- mutt-1.3.28.orig/browser.c Tue Dec 18 09:13:17 2001 +++ mutt-1.3.28/browser.c Wed Jun 4 16:59:58 2003 @@ -300,8 +300,10 @@ } static void add_folder (MUTTMENU *m, struct browser_state *state, - const char *name, const struct stat *s, int new) + const char *name, const struct stat *s, BUFFY *mbuf) { + int new = (mbuf) ? mbuf->new : 0; + if (state->entrylen == state->entrymax) { /* need to allocate more space */ @@ -313,6 +315,9 @@ m->data = state->entry; } + if (mbuf && mbuf->magic == M_MAILDIR && mbuf->mtime) + s->st_mtime = mbuf->mtime; + if (s != NULL) { (state->entry)[state->entrylen].mode = s->st_mode; @@ -407,7 +412,7 @@ tmp = Incoming; while (tmp && mutt_strcmp (buffer, tmp->path)) tmp = tmp->next; - add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0); + add_folder (menu, state, de->d_name, &s, tmp); } closedir (dp); browser_sort (state); @@ -431,14 +436,14 @@ #ifdef USE_IMAP if (mx_is_imap (tmp->path)) { - add_folder (menu, state, tmp->path, NULL, tmp->new); + add_folder (menu, state, tmp->path, NULL, tmp); continue; } #endif #ifdef USE_POP if (mx_is_pop (tmp->path)) { - add_folder (menu, state, tmp->path, NULL, tmp->new); + add_folder (menu, state, tmp->path, NULL, tmp); continue; } #endif @@ -452,7 +457,7 @@ strfcpy (buffer, NONULL(tmp->path), sizeof (buffer)); mutt_pretty_mailbox (buffer); - add_folder (menu, state, buffer, &s, tmp->new); + add_folder (menu, state, buffer, &s, tmp); } while ((tmp = tmp->next)); browser_sort (state); diff -u mutt-1.3.28.orig/buffy.c mutt-1.3.28/buffy.c --- mutt-1.3.28.orig/buffy.c Wed Oct 10 05:34:11 2001 +++ mutt-1.3.28/buffy.c Wed Jun 4 16:56:34 2003 @@ -194,6 +194,7 @@ (*tmp)->new = 0; (*tmp)->notified = 1; (*tmp)->newly_created = 0; + (*tmp)->mtime = 0; #ifdef BUFFY_SIZE /* for buffy_size, it is important that if the folder is new (tested by @@ -225,6 +226,7 @@ { BUFFY *tmp; struct stat sb; + struct stat smd; struct dirent *de; DIR *dirp; char path[_POSIX_PATH_MAX]; @@ -264,6 +266,7 @@ for (tmp = Incoming; tmp; tmp = tmp->next) { tmp->new = 0; + tmp->mtime = 0; #ifdef USE_IMAP if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path)) @@ -349,10 +352,17 @@ if (*de->d_name != '.' && (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T'))) { - /* one new and undeleted message is enough */ - BuffyCount++; - tmp->new = 1; - break; + if (!tmp->new) + { + /* one new and undeleted message is enough */ + BuffyCount++; + tmp->new = 1; + } + snprintf (path, sizeof (path), "%s/new/%s", tmp->path, de->d_name); + if (!stat (path, &smd) && smd.st_mtime > tmp->mtime) + { + tmp->mtime = smd.st_mtime; + } } } closedir (dirp); diff -u mutt-1.3.28.orig/buffy.h mutt-1.3.28/buffy.h --- mutt-1.3.28.orig/buffy.h Fri Mar 3 04:10:06 2000 +++ mutt-1.3.28/buffy.h Wed Jun 4 16:51:30 2003 @@ -23,6 +23,7 @@ long size; #endif /* BUFFY_SIZE */ struct buffy_t *next; + time_t mtime; /* for maildirs...time of newest entry */ short new; /* mailbox has new mail */ short notified; /* user has been notified */ short magic; /* mailbox type */