From ae01731bb869a922c0cffab1efe39efda51f7496 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 7 Sep 2008 17:29:40 -0300 Subject: [PATCH] sort rootset by date --- IkiWiki/Plugin/mailbox.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/mailbox.pm b/IkiWiki/Plugin/mailbox.pm index bf626030b..df77579f7 100644 --- a/IkiWiki/Plugin/mailbox.pm +++ b/IkiWiki/Plugin/mailbox.pm @@ -19,7 +19,7 @@ use Email::Thread; use CGI 'escapeHTML'; use File::Temp qw/tempfile/; use File::MimeInfo::Magic; - +use Date::Parse; my %metaheaders; @@ -82,7 +82,11 @@ sub format_mailbox(@){ $threader->thread(); - return join "\n", map { format_thread(%params,thread=>$_) } $threader->rootset; + my @roots= sort { str2time($a->header('Date')) <=> + str2time($b->header('Date'))} ($threader->rootset); + + return join "\n", map { format_thread(%params,thread=>$_) } @roots; + } sub format_thread(@){ -- 2.39.2