You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2022/04/15 12:18:08 UTC

svn commit: r1899889 - /spamassassin/trunk/spamd/spamd.raw

Author: sidney
Date: Fri Apr 15 12:18:08 2022
New Revision: 1899889

URL: http://svn.apache.org/viewvc?rev=1899889&view=rev
Log:
bug 5740 spamd tries to bayes learn when reporting even when bayes is disabled

Modified:
    spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamd/spamd.raw?rev=1899889&r1=1899888&r2=1899889&view=diff
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Fri Apr 15 12:18:08 2022
@@ -2213,18 +2213,23 @@ sub dotell {
   my @did_set;
   my @did_remove;
 
-  if ($hdrs->{set_local}) {
-    my $status = $spamtest->learn($mail, undef, ($hdrs->{message_class} eq 'spam' ? 1 : 0), 0);
+  # bug 5740 Don't bayes learn if global configs disabkle bayes,
+  #  also give user some control with userprefs bayes_learn_during_report option
 
-    push(@did_set, 'local') if ($status->did_learn());
-    $status->finish();
-  }
+  if (defined $spamtest->{bayes_scanner} && $spamtest->{conf}->{bayes_learn_during_report}) {
+    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();
+    }
 
-  if ($hdrs->{remove_local}) {
-    my $status = $spamtest->learn($mail, undef, undef, 1);
+    if ($hdrs->{remove_local}) {
+      my $status = $spamtest->learn($mail, undef, undef, 1);
 
-    push(@did_remove, 'local') if ($status->did_learn());
-    $status->finish();
+      push(@did_remove, 'local') if ($status->did_learn());
+      $status->finish();
+    }
   }
 
   if ($hdrs->{set_remote}) {