X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FView.pm;h=867ed6fab2e33508ed7f8380251e45025441d95b;hb=3cda6050b7c8f73e7fd86f88efc5cd42d0c13f73;hp=15d846a635425dc66c7b2ffe37cd11a1e24e7453;hpb=f564327fd1e694056a4b13ed398cabd8d0d4c173;p=public-inbox.git diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 15d846a6..867ed6fa 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -12,16 +12,13 @@ use Encode qw/find_encoding/; use Encode::MIME::Header; use Email::MIME::ContentType qw/parse_content_type/; use PublicInbox::Hval; -use PublicInbox::MID qw/mid_clean id_compress mid2path/; -use Digest::SHA qw/sha1_hex/; -my $SALT = rand; -my $MBOX_TITLE = 'title="download thread as gzipped mbox"'; +use PublicInbox::Linkify; +use PublicInbox::MID qw/mid_clean id_compress mid2path mid_mime/; require POSIX; # TODO: make these constants tunable use constant MAX_INLINE_QUOTED => 12; # half an 80x24 terminal use constant MAX_TRUNC_LEN => 72; -use constant PRE_WRAP => ""; use constant T_ANCHOR => '#u'; use constant INDENT => ' '; @@ -37,27 +34,69 @@ sub msg_html { } else { $footer = ''; } - headers_to_html_header($mime, $full_pfx, $ctx) . + my $hdr = $mime->header_obj; + headers_to_html_header($hdr, $full_pfx, $ctx) . multipart_text_as_html($mime, $full_pfx) . - '
' . PRE_WRAP . - html_footer($mime, 1, $full_pfx, $ctx) . + '
' .
+		html_footer($hdr, 1, $full_pfx, $ctx) .
 		$footer .
 		'
'; } +# /$LISTNAME/$MESSAGE_ID/R/ +sub msg_reply { + my ($ctx, $hdr, $footer) = @_; + my $s = $hdr->header('Subject'); + $s = '(no subject)' if (!defined $s) || ($s eq ''); + my $f = $hdr->header('From'); + $f = '' unless defined $f; + $s = PublicInbox::Hval->new_oneline($s); + my $mid = $hdr->header_raw('Message-ID'); + $mid = PublicInbox::Hval->new_msgid($mid); + my $t = $s->as_html; + my $se_url = + 'https://kernel.org/pub/software/scm/git/docs/git-send-email.html'; + + my ($arg, $link) = mailto_arg_link($hdr); + push @$arg, '/path/to/YOUR_REPLY'; + + "replying to \"$t\"
" .
+	"replying to message:\n\n" .
+	"Subject: $t\n" .
+	"From: ". ascii_html($f) .
+	"\nDate: " .  ascii_html($hdr->header('Date')) .
+	"\nMessage-ID: <" . $mid->as_html . ">\n\n" .
+	"There are multiple ways to reply:\n\n" .
+	"* Save the following mbox file, import it into your mail client,\n" .
+	"  and reply-to-all from there: mbox\n\n" .
+	"* Reply to all the recipients using the --to, --cc,\n" .
+	"  and --in-reply-to switches of git-send-email(1):\n\n" .
+	"\tgit send-email \\\n\t\t" .
+	join(" \\ \n\t\t", @$arg ). "\n\n" .
+	qq(  $se_url\n\n) .
+	"* If your mail client supports setting the In-Reply-To" .
+	" header\n  via mailto: links, try the " .
+	qq(mailto: link\n) .
+	"\nFor context, the original message or " .
+	qq(thread) .
+	'

' . $footer .  '
'; +} + sub feed_entry { my ($class, $mime, $full_pfx) = @_; - PRE_WRAP . multipart_text_as_html($mime, $full_pfx) . ''; + # no here for