Browse files

Plugin.pm: made is_naughty is now a getter too

  • Loading branch information...
1 parent 2a12acc commit 2416d1e940369e6db1a923ee4865b2dee1dd7336 @msimerson msimerson committed Dec 17, 2013
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/Qpsmtpd/Plugin.pm
View
16 lib/Qpsmtpd/Plugin.pm
@@ -218,7 +218,7 @@ sub compile {
sub get_reject {
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 || '';
$log_mess = ", $log_mess" if $log_mess;
@@ -320,17 +320,17 @@ sub is_immune {
sub is_naughty {
my ($self, $setit) = @_;
- if ( defined $setit ) {
- $self->connection->notes('naughty', $setit);
- $self->connection->notes('rejected', $setit);
- };
+ # see plugins/naughty
+ return $self->connection->notes('naughty') if ! defined $setit;
- if ($self->connection->notes('naughty')) {
+ $self->connection->notes('naughty', $setit);
+ $self->connection->notes('rejected', $setit);
- # see plugins/naughty
+ if ($self->connection->notes('naughty')) {
$self->log(LOGINFO, "skip, naughty");
return 1;
}
+
if ($self->connection->notes('rejected')) {
# http://www.steve.org.uk/Software/ms-lite/
@@ -345,7 +345,7 @@ sub adjust_karma {
my $karma = $self->connection->notes('karma') || 0;
$karma += $value;
- $self->log(LOGDEBUG, "karma $value ($karma)");
+ $self->log(LOGINFO, "karma $value ($karma)");
$self->connection->notes('karma', $karma);
return $value;
}

0 comments on commit 2416d1e

Please sign in to comment.