about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-08-26 05:46:15 +0000
committerEric Wong <e@80x24.org>2014-08-26 05:50:47 +0000
commit0f104ebd05fb9c6e0dbbb4dcfac0dcdd9a9059ab (patch)
tree7d5c206404f4ecee3b43f868c7fc7acd654e332c
parent262ec71aba2eb8cf80cc85f387a0fd7edac94fe1 (diff)
downloadpublic-inbox-0f104ebd05fb9c6e0dbbb4dcfac0dcdd9a9059ab.tar.gz
This is probably useful information for folks browsing via web
interface.  It'll probably make more sense if we show the entire
body in the threaded display, though.
-rw-r--r--lib/PublicInbox/Feed.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 0104a6ba..4ec8e979 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -85,7 +85,7 @@ sub generate_html_index {
                         $a->topmost->message->header('X-PI-Date')
                 } @_;
         });
-        dump_html_line($_, 0, \$html) for $th->rootset;
+        dump_html_line($_, 0, \$html, time) for $th->rootset;
 
         Email::Address->purge_cache;
 
@@ -278,11 +278,11 @@ sub add_to_feed {
 }
 
 sub dump_html_line {
-        my ($self, $level, $html) = @_;
+        my ($self, $level, $html, $now) = @_;
         if ($self->message) {
-                $$html .= (' ' x $level);
                 my $mime = $self->message;
                 my $subj = $mime->header('Subject');
+                my $ts = $mime->header('X-PI-Date');
                 my $mid = $mime->header_obj->header_raw('Message-ID');
                 $mid = PublicInbox::Hval->new_msgid($mid);
                 my $href = 'm/' . $mid->as_href . '.html';
@@ -294,10 +294,17 @@ sub dump_html_line {
 
                 $from = PublicInbox::Hval->new_oneline($from)->as_html;
                 $subj = PublicInbox::Hval->new_oneline($subj)->as_html;
+                if ($now > ($ts + (24 * 60 * 60))) {
+                        $ts = POSIX::strftime('%m/%d ', gmtime($ts));
+                } else {
+                        $ts = POSIX::strftime('%H:%M ', gmtime($ts));
+                }
+
+                $$html .= $ts . (' ' x $level);
                 $$html .= "<a href=\"$href\">$subj</a> $from\n";
         }
-        dump_html_line($self->child, $level+1, $html) if $self->child;
-        dump_html_line($self->next, $level, $html) if $self->next;
+        dump_html_line($self->child, $level+1, $html, $now) if $self->child;
+        dump_html_line($self->next, $level, $html, $now) if $self->next;
 }
 
 sub do_cat_mail {