about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-25 09:27:16 +0000
committerEric Wong <e@80x24.org>2016-06-25 09:42:57 +0000
commitdde6d1169d8f9d6aaede9730144d1f60be2134c8 (patch)
tree6ee58f00ac142243d59a326108f241be9c54ac04 /lib/PublicInbox
parent18011be3dbfecb3abe4bea8cdf7f0ee7dfa2f8be (diff)
downloadpublic-inbox-dde6d1169d8f9d6aaede9730144d1f60be2134c8.tar.gz
It is important to show the decentralized nature of
communication in our web views.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/View.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 9fa2a9bd..d906276a 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -83,6 +83,12 @@ sub in_reply_to {
         undef;
 }
 
+sub _hdr_names ($$) {
+        my ($hdr, $field) = @_;
+        my $val = $hdr->header($field) or return '';
+        ascii_html(join(', ', PublicInbox::Address::names($val)));
+}
+
 # this is already inside a <pre>
 sub index_entry {
         my ($mime, $level, $state) = @_;
@@ -98,7 +104,6 @@ sub index_entry {
         $seen->{$id} = "#$id"; # save the anchor for children, later
 
         my $mid = PublicInbox::Hval->new_msgid($mid_raw);
-        my $from = PublicInbox::Address::from_name($hdr->header('From'));
 
         my $root_anchor = $state->{root_anchor} || '';
         my $path = $root_anchor ? '../../' : '';
@@ -106,7 +111,6 @@ sub index_entry {
         my $irt = in_reply_to($hdr);
         my $parent_anchor = $seen->{anchor_for($irt)} if defined $irt;
 
-        $from = ascii_html($from);
         $subj = ascii_html($subj);
         $subj = "<a\nhref=\"${path}$href/\">$subj</a>";
         $subj = "<u\nid=u>$subj</u>" if $root_anchor eq $id;
@@ -116,7 +120,15 @@ sub index_entry {
         $rv .= "<b\nid=$id>$subj</b>\n";
         my $txt = "${path}$href/raw";
         my $fh = $state->{fh};
-        $fh->write($rv .= "- $from @ $ts UTC (<a\nhref=\"$txt\">raw</a>)\n\n");
+        my $from = _hdr_names($hdr, 'From');
+        $rv .= "- $from @ $ts UTC (<a\nhref=\"$txt\">raw</a>)\n";
+        my @tocc;
+        foreach my $f (qw(To Cc)) {
+                my $dst = _hdr_names($hdr, $f);
+                push @tocc, "$f: $dst" if $dst ne '';
+        }
+        $rv .= '  '.join('; +', @tocc) . "\n" if @tocc;
+        $fh->write($rv .= "\n");
 
         my $mhref = "${path}$href/";