]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
www: drop --subject from "git send-email" instructions
[public-inbox.git] / lib / PublicInbox / View.pm
index 805e785bfedca66385e2ecc056cd4c26ceaf7971..fa96cca337d87f9113425a209c5b78aafa2b6dfa 100644 (file)
@@ -31,7 +31,9 @@ sub msg_page_i {
        my ($ctx, $eml) = @_;
        if ($eml) { # called by WwwStream::async_eml or getline
                my $smsg = $ctx->{smsg};
-               $ctx->{smsg} = $ctx->{over}->next_by_mid(@{$ctx->{next_arg}});
+               my $over = $ctx->{ibx}->over;
+               $ctx->{smsg} = $over ? $over->next_by_mid(@{$ctx->{next_arg}})
+                               : $ctx->gone('over');
                $ctx->{mhref} = ($ctx->{nr} || $ctx->{smsg}) ?
                                "../${\mid_href($smsg->{mid})}/" : '';
                my $obuf = $ctx->{obuf} = _msg_page_prepare_obuf($eml, $ctx);
@@ -70,7 +72,7 @@ sub msg_page {
        my ($ctx) = @_;
        my $ibx = $ctx->{ibx};
        $ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
-       my $over = $ctx->{over} = $ibx->over or return no_over_html($ctx);
+       my $over = $ibx->over or return no_over_html($ctx);
        my ($id, $prev);
        my $next_arg = $ctx->{next_arg} = [ $ctx->{mid}, \$id, \$prev ];
 
@@ -140,6 +142,9 @@ $info
   <a
 href="$se_url">$se_url</a>
 $link</pre>
+
+  Be sure your reply has a <b>Subject:</b> header at the top and a blank line
+  before the message body.
 EOF
 }
 
@@ -258,7 +263,6 @@ sub eml_entry {
        } elsif ($mapping) {
                my $nested = 'nested';
                my $flat = 'flat';
-               my $end = '';
                if ($ctx->{flat}) {
                        $hr = 1;
                        $flat = "<b>$flat</b>";
@@ -531,6 +535,7 @@ sub attach_link ($$$$;$) {
 
        my $nl = $idx eq '1' ? '' : "\n"; # like join("\n", ...)
        my $size = length($part->body);
+       delete $part->{bdy}; # save memory
 
        # hide attributes normally, unless we want to aid users in
        # spotting MUA problems:
@@ -583,7 +588,7 @@ sub add_text_body { # callback for each_part
 
        # makes no difference to browsers, and don't screw up filename
        # link generation in diffs with the extra '%0D'
-       $s =~ s/\r\n/\n/sg;
+       $s =~ s/\r+\n/\n/sg;
 
        # will be escaped to `&#8226;' in HTML
        obfuscate_addrs($ibx, $s, "\x{2022}") if $ibx->{obfuscate};
@@ -622,9 +627,6 @@ sub add_text_body { # callback for each_part
                $ctx->{-spfx} = $spfx;
        };
 
-       # some editors don't put trailing newlines at the end:
-       $s .= "\n" unless $s =~ /\n\z/s;
-
        # split off quoted and unquoted blocks:
        my @sections = PublicInbox::MsgIter::split_quotes($s);
        undef $s; # free memory
@@ -633,6 +635,7 @@ sub add_text_body { # callback for each_part
                attach_link($ctx, $ct, $p, $fn, $err);
                $$rv .= "\n";
        }
+       delete $part->{bdy}; # save memory
        foreach my $cur (@sections) {
                if ($cur =~ /\A>/) {
                        # we use a <span> here to allow users to specify
@@ -977,7 +980,7 @@ sub skel_dump { # walk_thread callback
                $$skel .= delete($ctx->{sl_note}) || '';
        }
 
-       my $f = ascii_html($smsg->{from_name});
+       my $f = ascii_html(delete $smsg->{from_name});
        my $obfs_ibx = $ctx->{-obfs_ibx};
        obfuscate_addrs($obfs_ibx, $f) if $obfs_ibx;
 
@@ -1072,10 +1075,10 @@ sub _skel_ghost {
 }
 
 sub sort_ds {
-       [ sort {
+       @{$_[0]} = sort {
                (eval { $a->topmost->{ds} } || 0) <=>
                (eval { $b->topmost->{ds} } || 0)
-       } @{$_[0]} ];
+       } @{$_[0]};
 }
 
 # accumulate recent topics if search is supported