patch-src::MandatoryLearn-3.1.0.patch by Victor Ustugov diff -urN lib.orig/Mail/SpamAssassin/PerMsgStatus.pm lib/Mail/SpamAssassin/PerMsgStatus.pm --- lib.orig/Mail/SpamAssassin/PerMsgStatus.pm 2005-12-26 11:28:36.000000000 +0200 +++ lib/Mail/SpamAssassin/PerMsgStatus.pm 2005-12-26 11:28:55.000000000 +0200 @@ -379,6 +379,12 @@ return $self->{body_only_points}; } +sub get_mandatory_learn { + my ($self) = @_; + $self->_get_autolearn_points(); + return $self->{mandatory_learn}; +} + sub _get_autolearn_points { my ($self) = @_; @@ -409,6 +415,7 @@ $self->{learned_points} = 0; $self->{body_only_points} = 0; $self->{head_only_points} = 0; + $self->{mandatory_learn} = 0; foreach my $test (@{$self->{test_names_hit}}) { # According to the documentation, noautolearn, userconf, and learn @@ -417,6 +424,8 @@ next if $tflags->{$test} =~ /\bnoautolearn\b/; next if $tflags->{$test} =~ /\buserconf\b/; + $self->{mandatory_learn} = 1 if $tflags->{$test} =~ /\bmandatory_learn\b/; + # Keep track of the learn points for an additional autolearn check. # Use the original scoreset since it'll be 0 in sets 0 and 1. if ($tflags->{$test} =~ /\blearn\b/) { diff -urN lib.orig/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm --- lib.orig/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm 2005-12-26 11:05:09.000000000 +0200 +++ lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm 2005-12-26 11:12:18.000000000 +0200 @@ -131,6 +131,12 @@ my $body_only_points = $scan->get_body_only_points(); my $head_only_points = $scan->get_head_only_points(); my $learned_points = $scan->get_learned_points(); + my $mandatory_learn = $scan->get_mandatory_learn(); + + if ($mandatory_learn) { + dbg("learn: auto-learn? yes, mandatory_learn"); + return $mandatory_learn; + } dbg("learn: auto-learn? ham=$min, spam=$max, ". "body-points=".$body_only_points.", ".