user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/2] view: show To/Cc destinations in conversation view
Date: Sat, 25 Jun 2016 09:44:05 +0000	[thread overview]
Message-ID: <20160625094405.9616-3-e@80x24.org> (raw)
In-Reply-To: <20160625094405.9616-1-e@80x24.org>

It is important to show the decentralized nature of
communication in our web views.
---
 lib/PublicInbox/View.pm | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 9fa2a9b..d906276 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/";
 
-- 
EW


      parent reply	other threads:[~2016-06-25  9:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25  9:44 [PATCH 0/2] www: show To/Cc destinations in conversation view Eric Wong
2016-06-25  9:44 ` [PATCH 1/2] address: beef up the module with name list extaction Eric Wong
2016-06-25  9:44 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160625094405.9616-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).