]> Sergey Matveev's repositories - public-inbox.git/commitdiff
learn: scan all inboxes when learning spam
authorEric Wong <e@80x24.org>
Wed, 5 Apr 2017 01:41:28 +0000 (01:41 +0000)
committerEric Wong <e@80x24.org>
Wed, 5 Apr 2017 01:42:33 +0000 (01:42 +0000)
This matches the behavior of the -watch daemon since
6d534038285ddd760709ba76ea007f9108200097
("watch: watchspam affects all configured inboxes")

script/public-inbox-learn

index 38c83243f8971e63859fe4261b7ba4d521ff2335..71aa50f9d5989b093b4efa50f4312267f8ce6440 100755 (executable)
@@ -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