diff options
author | Eric Wong <e@80x24.org> | 2016-02-23 06:52:09 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-02-24 04:04:20 +0000 |
commit | 62a77b55c9fadec1b4b1ba061e99f4a18d8a14bc (patch) | |
tree | 68a09ad1293678bfbc1a206e8c1ff0200d84074f /lib/PublicInbox/WWW.pm | |
parent | 09b11c8725e3a19d3c126c3d3e993caa0169a268 (diff) | |
download | public-inbox-62a77b55c9fadec1b4b1ba061e99f4a18d8a14bc.tar.gz |
Setting the "In-Reply-To:" header via mailto: links is not well-supported and should probably not be encouraged unless the client situation improves. So instead, teach users more widely-supported ways of setting the In-Reply-To: header to ensure proper threading of replies.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 77910f67..1f28df20 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -21,7 +21,7 @@ require PublicInbox::Git; use PublicInbox::GitHTTPBackend; our $LISTNAME_RE = qr!\A/([\w\.\-]+)!; our $MID_RE = qr!([^/]+)!; -our $END_RE = qr!(f/|T/|t/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; +our $END_RE = qr!(f/|T/|t/|R/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; our $pi_config; sub run { @@ -58,7 +58,7 @@ sub run { msg_page($ctx, $1, $2, $3); # in case people leave off the trailing slash: - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/(f|T|t)\z!o) { + } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/(f|T|t|R)\z!o) { my ($listname, $mid, $suffix) = ($1, $2, $3); $suffix .= $suffix =~ /\A[tT]\z/ ? '/#u' : '/'; r301($ctx, $listname, $mid, $suffix); @@ -200,6 +200,19 @@ sub get_full_html { [ PublicInbox::View::msg_html($ctx, $mime, undef, $foot)] ]; } +# /$LISTNAME/$MESSAGE_ID/R/ -> HTML content (fullquotes) +sub get_reply_html { + my ($ctx) = @_; + my $x = mid2blob($ctx) or return r404($ctx); + + require PublicInbox::View; + my $foot = footer($ctx); + require Email::MIME; + my $hdr = Email::MIME->new($x)->header_obj; + [ 200, [ 'Content-Type' => 'text/html; charset=UTF-8' ], + [ PublicInbox::View::msg_reply($ctx, $hdr, $foot)] ]; +} + # /$LISTNAME/$MESSAGE_ID/t/ sub get_thread { my ($ctx, $flat) = @_; @@ -407,6 +420,7 @@ sub msg_page { 'T/' eq $e and return get_thread($ctx, 1); 'raw' eq $e and return get_mid_txt($ctx); 'f/' eq $e and return get_full_html($ctx); + 'R/' eq $e and return get_reply_html($ctx); } r404($ctx); } |