my %subcommands =
('auto-scan' => {function => \&auto_spamscan,
- arguments => {'ham_threshold=s' => -5,
+ arguments => {'ham_threshold|ham-threshold=s' => 0,
},
+ defaults => {ham_threshold => -5},
},
'score' => {function => \&score_bug,
arguments => {'skip_seen|skip-seen!' => 0
chdir($config{spool_dir}) or die "chdir $config{spool_dir} failed: $!";
}
my $opts =
- handle_subcommand_arguments(\@ARGV,$subcommands{$subcommand}{arguments});
+ handle_subcommand_arguments(\@ARGV,
+ $subcommands{$subcommand}{arguments},
+ $subcommands{$subcommand}{defaults},
+ );
$subcommands{$subcommand}{function}->(\%options,$opts,\%config,\@ARGV);
if ($is_spam) {
print STDERR "it's spam ($score)\n" if $DEBUG;
$spam->add_spam($mid);
- } elsif ($score < $options->{ham_threshold}) {
+ } elsif ($score < $opts->{ham_threshold}) {
print STDERR "it's really ham ($score)\n" if $DEBUG;
$spam->add_ham($mid);
}
my ($msg_id) = record_regex($record,
qr/^Message-Id:\s+<(.+)>/mi);
next unless defined $msg_id;
+ print STDERR "examining $msg_id: " if $DEBUG;
if ($msg_id =~ /$config{email_domain}$/) {
- print STDERR "skipping $msg_id\n" if $DEBUG;
+ print STDERR "skipping\n" if $DEBUG;
next;
}
- print STDERR "examining $msg_id: " if $DEBUG;
if ($seen_msgids{$msg_id}) {
print STDERR "already seen\n" if $DEBUG;
next;
}
$seen_msgids{$msg_id}=1;
$sub->($bug_num,$record,$msg_id);
+ print STDERR "\n" if $DEBUG;
}
}