]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-learn
build: add "git-dist" target for making gzipped tarballs
[public-inbox.git] / script / public-inbox-learn
old mode 100755 (executable)
new mode 100644 (file)
index 56739f8..3073294
@@ -77,7 +77,7 @@ if ($train eq 'spam') {
                $im->done;
        });
 } else {
-       require PublicInbox::MDA if $train eq "ham";
+       require PublicInbox::MDA;
 
        # get all recipients
        my %dests; # address => <PublicInbox::Inbox|0(false)>
@@ -89,10 +89,17 @@ if ($train eq 'spam') {
        }
 
        # n.b. message may be cross-posted to multiple public-inboxes
+       my %seen;
        while (my ($addr, $ibx) = each %dests) {
                next unless ref($ibx); # $ibx may be 0
+               next if $seen{"$ibx"}++;
                remove_or_add($ibx, $train, $addr);
        }
+       my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime);
+       for my $ibx (@$dests) {
+               next if !$seen{"$ibx"}++;
+               remove_or_add($ibx, $train, $ibx->{-primary_address});
+       }
 }
 
 if ($err) {