- # Ham messages are trained when they're marked into
- # a SEEN state, so this is idempotent:
- run([PublicInbox::MDA->cmd, $git_dir], \$s, \$out, \$err);
- if ($err !~ /CONFLICT/) {
- $err = 1;
+ if ($train eq "rm") {
+ # This needs to be idempotent, as my inotify trainer
+ # may train for each cross-posted message, and this
+ # script already learns for every list in
+ # ~/.public-inbox/config
+ $im->remove($mime, $train);
+ } elsif ($train eq "ham") {
+ # no checking for spam here, we assume the message has
+ # been reviewed by a human at this point:
+ PublicInbox::MDA->set_list_headers($mime, $dst);
+
+ # Ham messages are trained when they're marked into
+ # a SEEN state, so this is idempotent:
+ $im->add($mime);