]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/mailbox.pm
sort rootset by date
[git.ikiwiki.info.git] / IkiWiki / Plugin / mailbox.pm
index bf626030bb69a3f78a7fa443a6fe5838b0b3a1bd..df77579f776387a9fe5ccd0ceee8f3db22954e15 100644 (file)
@@ -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(@){