From c7f0a31a988a01d8c1c66cd94706b73a8941fe93 Mon Sep 17 00:00:00 2001 From: Rocco Rutte Date: Wed, 29 Apr 2009 14:49:09 +0200 Subject: [PATCH] Fix maildir times in mailboxes browser. Closes #626. Instead of using the (pointless) mtime of the top-level maildir folder, use the latest mtime of the "new" and "cur" subdirectories. Maildir folders in the mailboxes list can now be properly sorted by date. This does not affect the directory browser. Also see #2421. --- ChangeLog | 14 ++++++++++++++ browser.c | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6a3257598..9d16d5a88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-04-29 11:53 +0200 Rocco Rutte (366d992abcb4) + + * mailbox.h, mh.c, mx.c: Move Maildir/MH folder detection from mx.c to + mh.c + +2009-04-28 15:12 +0200 Rocco Rutte (4d9685be5987) + + * sendlib.c: Fold References: header so we never run into line length + problems + +2009-04-28 14:27 +0200 Rocco Rutte (027edb15e455) + + * ChangeLog, headers.c: Fix comment typo + 2009-04-28 14:18 +0200 Bertram Felgenhauer (6b20a3545f03) * doc/manual.xml.head, headers.c: Drop References header if In-Reply- diff --git a/browser.c b/browser.c index 2214984ba..7c2ac458f 100644 --- a/browser.c +++ b/browser.c @@ -460,6 +460,21 @@ static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state) if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) && (! S_ISLNK (s.st_mode))) continue; + + if (mx_is_maildir (tmp->path)) + { + struct stat st2; + char md[_POSIX_PATH_MAX]; + + snprintf (md, sizeof (md), "%s/new", tmp->path); + if (stat (md, &s) < 0) + s.st_mtime = 0; + snprintf (md, sizeof (md), "%s/cur", tmp->path); + if (stat (md, &st2) < 0) + st2.st_mtime = 0; + if (st2.st_mtime > s.st_mtime) + memcpy (&s, &st2, sizeof (struct stat)); + } strfcpy (buffer, NONULL(tmp->path), sizeof (buffer)); mutt_pretty_mailbox (buffer, sizeof (buffer)); -- 2.40.0