X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FView.pm;h=e7e387d3069f0f5f04daf1873b6bd09ec40fa7c0;hb=4af9fd9c5e46eed341a535f37d54cf228303326c;hp=ad03cfe22efbc874e045bcff8d97dc362296ad3b;hpb=9f297a938dc3dec3d2ab5ba56394c97f393a95e4;p=public-inbox.git diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index ad03cfe2..e7e387d3 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -8,56 +8,71 @@ use strict; use warnings; use URI::Escape qw/uri_escape_utf8/; use Date::Parse qw/str2time/; -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; +use Plack::Util; +use PublicInbox::Hval qw/ascii_html/; +use PublicInbox::Linkify; +use PublicInbox::MID qw/mid_clean id_compress mid2path mid_mime/; +use PublicInbox::MsgIter; +use PublicInbox::Address; +use PublicInbox::WwwStream; 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 T_ANCHOR => '#u'; use constant INDENT => ' '; +use constant TCHILD => '` '; +sub th_pfx ($) { $_[0] == 0 ? '' : TCHILD }; -*ascii_html = *PublicInbox::Hval::ascii_html; - -my $enc_utf8 = find_encoding('UTF-8'); - -# public functions: +# public functions: (unstable) sub msg_html { - my ($ctx, $mime, $full_pfx, $footer) = @_; - if (defined $footer) { - $footer = "\n" . $footer; - } else { - $footer = ''; - } - headers_to_html_header($mime, $full_pfx, $ctx) . - multipart_text_as_html($mime, $full_pfx) . - '
' .
-		html_footer($mime, 1, $full_pfx, $ctx) .
-		$footer .
-		'
'; + my ($ctx, $mime, $footer) = @_; + my $hdr = $mime->header_obj; + my $tip = _msg_html_prepare($hdr, $ctx); + PublicInbox::WwwStream->new($ctx, sub { + my ($nr, undef) = @_; + if ($nr == 1) { + $tip . multipart_text_as_html($mime, '') . + '
' + } elsif ($nr == 2) { + '
' . html_footer($hdr, 1, $ctx) .
+			'
' . msg_reply($ctx, $hdr) . '
' + } else { + undef + } + }); } -sub feed_entry { - my ($class, $mime, $full_pfx) = @_; +# /$INBOX/$MESSAGE_ID/#R +sub msg_reply { + my ($ctx, $hdr) = @_; + 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'; - # no here for