Plugin.pm: made is_naughty is now a getter too

This commit is contained in:
Matt Simerson 2013-12-17 23:43:26 -05:00
parent 2a12acce6e
commit 2416d1e940

View File

@ -218,7 +218,7 @@ sub compile {
sub get_reject { sub get_reject {
my $self = shift; my $self = shift;
my $smtp_mess = shift || "why didn't you pass an error message?"; my $smtp_mess = shift || "unspecified error";
my $log_mess = shift || ''; my $log_mess = shift || '';
$log_mess = ", $log_mess" if $log_mess; $log_mess = ", $log_mess" if $log_mess;
@ -320,17 +320,17 @@ sub is_immune {
sub is_naughty { sub is_naughty {
my ($self, $setit) = @_; my ($self, $setit) = @_;
if ( defined $setit ) { # see plugins/naughty
$self->connection->notes('naughty', $setit); return $self->connection->notes('naughty') if ! defined $setit;
$self->connection->notes('rejected', $setit);
}; $self->connection->notes('naughty', $setit);
$self->connection->notes('rejected', $setit);
if ($self->connection->notes('naughty')) { if ($self->connection->notes('naughty')) {
# see plugins/naughty
$self->log(LOGINFO, "skip, naughty"); $self->log(LOGINFO, "skip, naughty");
return 1; return 1;
} }
if ($self->connection->notes('rejected')) { if ($self->connection->notes('rejected')) {
# http://www.steve.org.uk/Software/ms-lite/ # http://www.steve.org.uk/Software/ms-lite/
@ -345,7 +345,7 @@ sub adjust_karma {
my $karma = $self->connection->notes('karma') || 0; my $karma = $self->connection->notes('karma') || 0;
$karma += $value; $karma += $value;
$self->log(LOGDEBUG, "karma $value ($karma)"); $self->log(LOGINFO, "karma $value ($karma)");
$self->connection->notes('karma', $karma); $self->connection->notes('karma', $karma);
return $value; return $value;
} }