Bug 5740

Summary: It is impossible to report (to remote service) a message via spamc if bayes is disabled
Product: Spamassassin Reporter: Andrey Lelikov <spambugz>
Component: spamc/spamdAssignee: SpamAssassin Developer Mailing List <dev>
Status: NEW ---    
Severity: major CC: parkerm
Priority: P3    
Version: 3.2.1   
Target Milestone: Undefined   
Hardware: All   
OS: Linux   

Description Andrey Lelikov 2007-12-05 10:38:30 UTC
spamassasin has a -r option to report message as spam (or ham). By default it
also calls learn method which fails if bayes is disabled. This may be disabled
by setting bayes_learn_during_report to 0. 
spamc has -C option for the same purpose, but it will never work if bayes is
disabled. spamc always sets set_remote and set_local flags, and spamd always
calls learn() if set_local flag is set - so bayes_learn_during_report option is
not checked and spamd fails with 'Can't call method "learn" on an undefined
value'. workaround is to comment following code in spamd, but this is ugly.

#  if ($hdrs->{set_local}) {
#    my $status = $spamtest->learn($mail, undef, ($hdrs->{message_class} eq
'spam' ? 1 : 0), 0);

#    push(@did_set, 'local') if ($status->did_learn());
#    $status->finish();
#  }