]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
watch: improve fairness during full rescans
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index f92790f4a957472f6c79ede6bd0e8add9bb4178f..a5974034d20a3335ddc517e50d7b9c3e181b4b98 100644 (file)
@@ -7,7 +7,7 @@ use strict;
 use warnings;
 use URI::Escape qw(uri_unescape uri_escape);
 use PublicInbox::SearchMsg;
-use PublicInbox::Hval qw/ascii_html/;
+use PublicInbox::Hval qw/ascii_html obfuscate_addrs/;
 use PublicInbox::View;
 use PublicInbox::WwwAtomStream;
 use PublicInbox::MID qw(mid2path mid_mime mid_clean mid_escape MID_ESC);
@@ -89,6 +89,8 @@ sub mset_summary {
        my $pfx = ' ' x $pad;
        my $res = \($ctx->{-html_tip});
        my $srch = $ctx->{srch};
+       my $ibx = $ctx->{-inbox};
+       my $obfs_ibx = $ibx->{obfuscate} ? $ibx : undef;
        foreach my $m ($mset->items) {
                my $rank = sprintf("%${pad}d", $m->get_rank + 1);
                my $pct = $m->get_percent;
@@ -102,6 +104,10 @@ sub mset_summary {
                }
                my $s = ascii_html($smsg->subject);
                my $f = ascii_html($smsg->from_name);
+               if ($obfs_ibx) {
+                       obfuscate_addrs($obfs_ibx, $s);
+                       obfuscate_addrs($obfs_ibx, $f);
+               }
                my $ts = PublicInbox::View::fmt_ts($smsg->ts);
                my $mid = PublicInbox::Hval->new_msgid($smsg->mid)->{href};
                $$res .= qq{$rank. <b><a\nhref="$mid/">}.
@@ -223,8 +229,11 @@ sub mset_thread {
        $ctx->{seen} = {};
        $ctx->{s_nr} = scalar(@$msgs).'+ results';
 
+       # reduce hash lookups in skel_dump
+       $ctx->{-obfuscate} = $ctx->{-inbox}->{obfuscate};
        PublicInbox::View::walk_thread($rootset, $ctx,
                *PublicInbox::View::pre_thread);
+
        @$msgs = reverse @$msgs if $r;
        my $mime;
        sub {