s/txn/transaction/ and perltidy cleanup (Steve Kemp)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@885 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
f315e1c193
commit
569ea2a512
@ -125,7 +125,7 @@ sub check_talker_post {
|
||||
}
|
||||
|
||||
sub hook_mail {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
|
||||
return DECLINED unless $self->connection->notes('earlytalker');
|
||||
return (DENY,$MSG) if $self->{_args}->{'action'} eq 'deny';
|
||||
|
@ -199,7 +199,7 @@ sub data_handler {
|
||||
}
|
||||
|
||||
sub mail_handler {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
my $msg = 'Connecting host started transmitting before SMTP greeting';
|
||||
|
||||
return DECLINED unless $self->qp->connection->notes('earlytalker');
|
||||
|
@ -183,9 +183,9 @@ sub register {
|
||||
}
|
||||
|
||||
sub log_output {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
my $output = $self->{_log_format};
|
||||
$output =~ s/%i/($txn->notes('logging-session-id') || 'parent')/ge;
|
||||
$output =~ s/%i/($transaction->notes('logging-session-id') || 'parent')/ge;
|
||||
$output = strftime $output, localtime;
|
||||
$output;
|
||||
}
|
||||
@ -216,28 +216,28 @@ sub open_log {
|
||||
#
|
||||
# Returns true if the file was reopened, zero if not, undef on error.
|
||||
sub maybe_reopen {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
|
||||
my $new_output = $self->log_output($txn);
|
||||
my $new_output = $self->log_output($transaction);
|
||||
if (!$self->{_current_output} ||
|
||||
$self->{_current_output} ne $new_output ||
|
||||
($self->{_reopen} &&
|
||||
!$txn->notes('file-reopened-this-session'))) {
|
||||
unless ($self->open_log($new_output, $txn)) {
|
||||
!$transaction->notes('file-reopened-this-session'))) {
|
||||
unless ($self->open_log($new_output, $transaction)) {
|
||||
return undef;
|
||||
}
|
||||
$txn->notes('file-reopened-this-session', 1);
|
||||
$transaction->notes('file-reopened-this-session', 1);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub hook_connect {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
|
||||
$txn->notes('file-logged-this-session', 0);
|
||||
$txn->notes('file-reopened-this-session', 0);
|
||||
$txn->notes('logging-session-id',
|
||||
$transaction->notes('file-logged-this-session', 0);
|
||||
$transaction->notes('file-reopened-this-session', 0);
|
||||
$transaction->notes('logging-session-id',
|
||||
sprintf("%08d-%04d-%d",
|
||||
scalar time, $$, ++$self->{_session_counter}));
|
||||
return DECLINED;
|
||||
@ -253,7 +253,7 @@ sub hook_disconnect {
|
||||
}
|
||||
|
||||
sub hook_logging {
|
||||
my ($self, $txn, $trace, $hook, $plugin, @log) = @_;
|
||||
my ($self, $transaction, $trace, $hook, $plugin, @log) = @_;
|
||||
|
||||
return DECLINED if !defined $self->{_loglevel} or
|
||||
$trace > $self->{_loglevel};
|
||||
@ -265,11 +265,11 @@ sub hook_logging {
|
||||
# - We haven't logged anything yet this session
|
||||
if (!$self->{_f} ||
|
||||
!$self->{_nosplit} ||
|
||||
!$txn->notes('file-logged-this-session')) {
|
||||
unless (defined $self->maybe_reopen($txn)) {
|
||||
!$transaction->notes('file-logged-this-session')) {
|
||||
unless (defined $self->maybe_reopen($transaction)) {
|
||||
return DECLINED;
|
||||
}
|
||||
$txn->notes('file-logged-this-session', 1);
|
||||
$transaction->notes('file-logged-this-session', 1);
|
||||
}
|
||||
|
||||
my $f = $self->{_f};
|
||||
|
@ -172,7 +172,7 @@ my %priorities_ = (
|
||||
);
|
||||
|
||||
sub hook_logging {
|
||||
my ($self, $txn, $trace, $hook, $plugin, @log) = @_;
|
||||
my ($self, $transaction, $trace, $hook, $plugin, @log) = @_;
|
||||
|
||||
return DECLINED if $trace > $self->{_loglevel};
|
||||
return DECLINED if defined $plugin and $plugin eq $self->plugin_name;
|
||||
|
@ -78,7 +78,7 @@ sub register {
|
||||
}
|
||||
|
||||
sub hook_queue {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
|
||||
my $tmp_dir = $self->qp->config('spool_dir') || '/tmp';
|
||||
$tmp_dir = $1 if ($tmp_dir =~ /(.*)/);
|
||||
@ -89,12 +89,12 @@ sub hook_queue {
|
||||
}
|
||||
|
||||
print $tmp "HELO ", hostname(), "\n",
|
||||
"MAIL FROM:<", ($txn->sender->address || ''), ">\n";
|
||||
"MAIL FROM:<", ($transaction->sender->address || ''), ">\n";
|
||||
print $tmp "RCPT TO:<", ($_->address || ''), ">\n"
|
||||
for $txn->recipients;
|
||||
print $tmp "DATA\n", $txn->header->as_string;
|
||||
$txn->body_resetpos;
|
||||
while (my $line = $txn->body_getline) {
|
||||
for $transaction->recipients;
|
||||
print $tmp "DATA\n", $transaction->header->as_string;
|
||||
$transaction->body_resetpos;
|
||||
while (my $line = $transaction->body_getline) {
|
||||
$line =~ s/^\./../;
|
||||
print $tmp $line;
|
||||
}
|
||||
|
@ -251,18 +251,18 @@ sub evaluate {
|
||||
}
|
||||
|
||||
sub data_handler {
|
||||
my ($self, $txn) = @_;
|
||||
my ($self, $transaction) = @_;
|
||||
my $l;
|
||||
my $queries = 0;
|
||||
my %pending;
|
||||
my @qp_continuations;
|
||||
|
||||
$txn->body_resetpos;
|
||||
while ($self->{check_headers} and $l = $txn->body_getline) {
|
||||
$transaction->body_resetpos;
|
||||
while ($self->{check_headers} and $l = $transaction->body_getline) {
|
||||
chomp $l;
|
||||
last if !$l;
|
||||
}
|
||||
while ($l = $txn->body_getline) {
|
||||
while ($l = $transaction->body_getline) {
|
||||
chomp $l;
|
||||
|
||||
if ($l =~ /(.*)=$/) {
|
||||
@ -378,7 +378,7 @@ sub data_handler {
|
||||
}
|
||||
}
|
||||
}
|
||||
$txn->body_resetpos;
|
||||
$transaction->body_resetpos;
|
||||
|
||||
unless ($queries) {
|
||||
$self->log(LOGINFO, "No URIs found in mail");
|
||||
@ -448,7 +448,7 @@ sub data_handler {
|
||||
for (@matches) {
|
||||
$self->log(LOGWARN, $_->{desc});
|
||||
if ($_->{action} eq 'add-header') {
|
||||
$txn->header->add('X-URIBL-Match', $_->{desc});
|
||||
$transaction->header->add('X-URIBL-Match', $_->{desc});
|
||||
} elsif ($_->{action} eq 'deny') {
|
||||
return (DENY, $_->{desc});
|
||||
} elsif ($_->{action} eq 'denysoft') {
|
||||
|
Loading…
Reference in New Issue
Block a user