]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-learn
ds|http|nntp: simplify {wbuf} population
[public-inbox.git] / script / public-inbox-learn
index 79f3ead5c722cda3d17cea9f4fc8ea185fa39530..93aece2e66b6c0d0fecf1d718070e5e213099f7a 100644 (file)
@@ -39,8 +39,8 @@ my $mime = PublicInbox::MIME->new(eval {
        $data
 });
 
-sub remove_or_add ($$$) {
-       my ($ibx, $train, $addr) = @_;
+sub remove_or_add ($$$$) {
+       my ($ibx, $train, $mime, $addr) = @_;
 
        # We do not touch GIT_COMMITTER_* env here so we can track
        # who trained the message.
@@ -93,11 +93,12 @@ if ($train eq 'spam') {
        while (my ($addr, $ibx) = each %dests) {
                next unless ref($ibx); # $ibx may be 0
                next if $seen{"$ibx"}++;
-               remove_or_add($ibx, $train, $addr);
+               remove_or_add($ibx, $train, $mime, $addr);
        }
-       my $ibx = PublicInbox::MDA->inbox_for_list_id($pi_config, $mime);
-       if ($ibx && !$seen{"$ibx"}) {
-               remove_or_add($ibx, $train, $ibx->{-primary_address});
+       my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime);
+       for my $ibx (@$dests) {
+               next if !$seen{"$ibx"}++;
+               remove_or_add($ibx, $train, $mime, $ibx->{-primary_address});
        }
 }