about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/ExtMsg.pm2
-rw-r--r--lib/PublicInbox/Search.pm2
-rw-r--r--lib/PublicInbox/SearchView.pm10
-rw-r--r--lib/PublicInbox/View.pm1
-rw-r--r--lib/PublicInbox/WatchMaildir.pm3
-rwxr-xr-xscript/public-inbox-learn12
-rw-r--r--t/view.t4
7 files changed, 24 insertions, 10 deletions
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 67ce0407..6cfc6c32 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -16,7 +16,7 @@ use PublicInbox::WwwStream;
 our @EXT_URL = (
         # leading "//" denotes protocol-relative (http:// or https://)
         '//marc.info/?i=%s',
-        '//mid.mail-archive.com/%s',
+        '//www.mail-archive.com/search?l=mid&q=%s',
         'http://mid.gmane.org/%s',
         'https://lists.debian.org/msgid-search/%s',
         '//docs.FreeBSD.org/cgi/mid.cgi?db=mid&id=%s',
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 02d1827e..b0bfe232 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -89,7 +89,7 @@ are also supported
 EOF
         'b:' => 'match within message body, including text attachments',
         'nq:' => 'match non-quoted text within message body',
-        'quot:' => 'match quoted text within message body',
+        'q:' => 'match quoted text within message body',
         'n:' => 'match filename of attachment(s)',
         't:' => 'match within the To header',
         'c:' => 'match within the Cc header',
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index f1c4b6a0..cec87c6a 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -145,7 +145,7 @@ sub search_nav_bot {
         my $o = $q->{o};
         my $end = $o + $nr;
         my $beg = $o + 1;
-        my $rv = '</pre><hr><pre>';
+        my $rv = '</pre><hr><pre id=t>';
         if ($beg <= $end) {
                 $rv .= "Results $beg-$end of $total";
                 $rv .= ' (estimated)' if $end != $total;
@@ -185,9 +185,9 @@ sub mset_thread {
                 $pct{$smsg->mid} = $i->get_percent;
                 $smsg;
         } ($mset->items) ]});
-
+        my $r = $q->{r};
         my $rootset = PublicInbox::SearchThread::thread($msgs,
-                $q->{r} ? sort_relevance(\%pct) : *PublicInbox::View::sort_ts);
+                $r ? sort_relevance(\%pct) : *PublicInbox::View::sort_ts);
         my $skel = search_nav_bot($mset, $q). "<pre>";
         my $inbox = $ctx->{-inbox};
         $ctx->{-upfx} = '';
@@ -203,11 +203,11 @@ sub mset_thread {
 
         PublicInbox::View::walk_thread($rootset, $ctx,
                 *PublicInbox::View::pre_thread);
-
+        @$msgs = reverse @$msgs if $r;
         my $mime;
         sub {
                 return unless $msgs;
-                while ($mime = shift @$msgs) {
+                while ($mime = pop @$msgs) {
                         $mime = $inbox->msg_by_smsg($mime) and last;
                 }
                 if ($mime) {
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 0b1ec75b..9ef4712f 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -438,6 +438,7 @@ sub attach_link ($$$$;$) {
         }
         $ret .= "[-- Attachment #$idx: ";
         my $ts = "Type: $ct, Size: $size bytes";
+        $desc = ascii_html($desc);
         $ret .= ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]";
         $ret .= "</a>\n";
 }
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 1823c248..985f9192 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -97,7 +97,8 @@ sub _try_fsn_paths {
 
 sub _remove_spam {
         my ($self, $path) = @_;
-        $path =~ /:2,[A-R]*S[T-Z]*\z/i or return;
+        # path must be marked as (S)een
+        $path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
         my $mime = _path_to_mime($path) or return;
         _force_mid($mime);
         $self->{config}->each_inbox(sub {
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index 38c83243..71aa50f9 100755
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -51,6 +51,18 @@ foreach my $h (qw(Cc To)) {
         }
 }
 
+if ($train eq 'spam') {
+        $pi_config->each_inbox(sub {
+                my ($ibx) = @_;
+                my $git = $ibx->git;
+                my $name = $ibx->{name};
+                my $addr = $ibx->{-primary_address};
+                my $im = PublicInbox::Import->new($git, $name, $addr, $ibx);
+                $im->remove($mime);
+                $im->done;
+        });
+}
+
 require PublicInbox::MDA if $train eq "ham";
 
 # n.b. message may be cross-posted to multiple public-inboxes
diff --git a/t/view.t b/t/view.t
index 46fbe410..2181b5ef 100644
--- a/t/view.t
+++ b/t/view.t
@@ -124,7 +124,7 @@ EOF
                 Email::MIME->create(
                         attributes => {
                                 content_type => 'text/plain',
-                                filename => "foo.patch",
+                                filename => "foo&.patch",
                         },
                         body => "--- a/file\n+++ b/file\n" .
                                 "@@ -49, 7 +49,34 @@\n",
@@ -140,7 +140,7 @@ EOF
         );
 
         my $html = msg_html($mime);
-        like($html, qr!.*Attachment #2: foo\.patch --!,
+        like($html, qr!.*Attachment #2: foo&(?:amp|#38);\.patch --!,
                 "parts split with filename");
 }