qpsmtpd/plugins/stats
2005-05-09 13:41:10 +00:00

32 lines
626 B
Perl

#!/usr/bin/perl -w
use Qpsmtpd::Stats;
sub register {
my ($self) = @_;
$self->register_hook('deny', 'increment_deny');
$self->register_hook('queue', 'increment_mails');
}
sub increment_deny {
my ($self, $tran, $plugin, $level) = @_;
if ($level == DENY or $level == DENY_DISCONNECT) {
$Qpsmtpd::Stats::MAILS_REJECTED++;
}
elsif ($level == DENYSOFT or $level == DENYSOFT_DISCONNECT) {
$Qpsmtpd::Stats::MAILS_TEMPFAIL++;
}
return DECLINED;
}
sub increment_mails {
my $self = shift;
$Qpsmtpd::Stats::MAILS_RECEIVED++;
return DECLINED;
}