From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 58DF244C1AE; Tue, 26 Aug 2014 05:54:01 +0000 (UTC) Date: Tue, 26 Aug 2014 05:54:01 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] show date in top-level threaded index Message-ID: <20140826055401.GA30307@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: 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. --- lib/PublicInbox/Feed.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 0104a6b..4ec8e97 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 .= "$subj $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 { -- EW