+ my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ };
+ local $SIG{__WARN__} = sub {
+ $warn_cb->("path: $path\n");
+ $warn_cb->(@_);
+ };
+ foreach my $ibx (@$inboxes) {
+ my $mime = mime_from_path($path) or next;
+ my $im = _importer_for($self, $ibx);
+
+ # any header match means it's eligible for the inbox:
+ if (my $watch_hdrs = $ibx->{-watchheaders}) {
+ my $ok;
+ my $hdr = $mime->header_obj;
+ for my $wh (@$watch_hdrs) {
+ my $v = $hdr->header_raw($wh->[0]);
+ next unless defined($v) && $v =~ $wh->[1];
+ $ok = 1;
+ last;
+ }
+ next unless $ok;
+ }
+
+ if (my $scrub = $ibx->filter($im)) {
+ my $ret = $scrub->scrub($mime) or next;
+ $ret == REJECT() and next;
+ $mime = $ret;
+ }
+ $im->add($mime, $self->{spamcheck});
+ }