X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FView.pm;h=e43872037ebc493d1c488b14ee1b91b8031f9299;hb=665fa99b39fe439e34c4e3042df1dfbb2bf1e956;hp=0a8ab549c97b878c8f2fa215b6a1230acec1850d;hpb=e022d3377fd2c50fd9931bf96394728958a90bf3;p=public-inbox.git diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 0a8ab549..e4387203 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -21,6 +21,8 @@ sub as_html { headers_to_html_header($mime, $full_pfx) . multipart_text_as_html($mime, $full_pfx) . + '
' .
+		html_footer($mime) .
 		'
'; } @@ -182,4 +184,33 @@ sub headers_to_html_header { '
' .  $rv);
 }
 
+sub html_footer {
+	my ($mime) = @_;
+	my %cc; # everyone else
+	my $to; # this is the From address
+
+	foreach my $h (qw(From To Cc)) {
+		my $v = $mime->header($h);
+		defined($v) && length($v) or next;
+		my @addrs = Email::Address->parse($v);
+		foreach my $recip (@addrs) {
+			my $address = $recip->address;
+			my $dst = lc($address);
+			$cc{$dst} ||= $address;
+			$to ||= $dst;
+		}
+	}
+
+	my $subj = $mime->header('Subject') || '';
+	$subj = "Re: $subj" unless $subj =~ /\bRe:/;
+	my $irp = uri_escape($mime->header_obj->header_raw('Message-ID') || '');
+	delete $cc{$to};
+	$to = uri_escape($to);
+
+	my $cc = uri_escape(join(',', values %cc));
+	my $href = "mailto:$to?In-Reply-To=$irp&Cc=${cc}&Subject=$subj";
+
+	'reply';
+}
+
 1;