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:
Ask Bjørn Hansen 2008-05-05 17:05:38 +00:00
parent f315e1c193
commit 569ea2a512
6 changed files with 41 additions and 41 deletions

View File

@ -125,7 +125,7 @@ sub check_talker_post {
} }
sub hook_mail { sub hook_mail {
my ($self, $txn) = @_; my ($self, $transaction) = @_;
return DECLINED unless $self->connection->notes('earlytalker'); return DECLINED unless $self->connection->notes('earlytalker');
return (DENY,$MSG) if $self->{_args}->{'action'} eq 'deny'; return (DENY,$MSG) if $self->{_args}->{'action'} eq 'deny';

View File

@ -199,7 +199,7 @@ sub data_handler {
} }
sub mail_handler { sub mail_handler {
my ($self, $txn) = @_; my ($self, $transaction) = @_;
my $msg = 'Connecting host started transmitting before SMTP greeting'; my $msg = 'Connecting host started transmitting before SMTP greeting';
return DECLINED unless $self->qp->connection->notes('earlytalker'); return DECLINED unless $self->qp->connection->notes('earlytalker');

View File

@ -183,9 +183,9 @@ sub register {
} }
sub log_output { sub log_output {
my ($self, $txn) = @_; my ($self, $transaction) = @_;
my $output = $self->{_log_format}; 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 = strftime $output, localtime;
$output; $output;
} }
@ -216,28 +216,28 @@ sub open_log {
# #
# Returns true if the file was reopened, zero if not, undef on error. # Returns true if the file was reopened, zero if not, undef on error.
sub maybe_reopen { 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} || if (!$self->{_current_output} ||
$self->{_current_output} ne $new_output || $self->{_current_output} ne $new_output ||
($self->{_reopen} && ($self->{_reopen} &&
!$txn->notes('file-reopened-this-session'))) { !$transaction->notes('file-reopened-this-session'))) {
unless ($self->open_log($new_output, $txn)) { unless ($self->open_log($new_output, $transaction)) {
return undef; return undef;
} }
$txn->notes('file-reopened-this-session', 1); $transaction->notes('file-reopened-this-session', 1);
return 1; return 1;
} }
return 0; return 0;
} }
sub hook_connect { sub hook_connect {
my ($self, $txn) = @_; my ($self, $transaction) = @_;
$txn->notes('file-logged-this-session', 0); $transaction->notes('file-logged-this-session', 0);
$txn->notes('file-reopened-this-session', 0); $transaction->notes('file-reopened-this-session', 0);
$txn->notes('logging-session-id', $transaction->notes('logging-session-id',
sprintf("%08d-%04d-%d", sprintf("%08d-%04d-%d",
scalar time, $$, ++$self->{_session_counter})); scalar time, $$, ++$self->{_session_counter}));
return DECLINED; return DECLINED;
@ -253,7 +253,7 @@ sub hook_disconnect {
} }
sub hook_logging { sub hook_logging {
my ($self, $txn, $trace, $hook, $plugin, @log) = @_; my ($self, $transaction, $trace, $hook, $plugin, @log) = @_;
return DECLINED if !defined $self->{_loglevel} or return DECLINED if !defined $self->{_loglevel} or
$trace > $self->{_loglevel}; $trace > $self->{_loglevel};
@ -265,11 +265,11 @@ sub hook_logging {
# - We haven't logged anything yet this session # - We haven't logged anything yet this session
if (!$self->{_f} || if (!$self->{_f} ||
!$self->{_nosplit} || !$self->{_nosplit} ||
!$txn->notes('file-logged-this-session')) { !$transaction->notes('file-logged-this-session')) {
unless (defined $self->maybe_reopen($txn)) { unless (defined $self->maybe_reopen($transaction)) {
return DECLINED; return DECLINED;
} }
$txn->notes('file-logged-this-session', 1); $transaction->notes('file-logged-this-session', 1);
} }
my $f = $self->{_f}; my $f = $self->{_f};

View File

@ -172,7 +172,7 @@ my %priorities_ = (
); );
sub hook_logging { 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 $trace > $self->{_loglevel};
return DECLINED if defined $plugin and $plugin eq $self->plugin_name; return DECLINED if defined $plugin and $plugin eq $self->plugin_name;

View File

@ -78,7 +78,7 @@ sub register {
} }
sub hook_queue { sub hook_queue {
my ($self, $txn) = @_; my ($self, $transaction) = @_;
my $tmp_dir = $self->qp->config('spool_dir') || '/tmp'; my $tmp_dir = $self->qp->config('spool_dir') || '/tmp';
$tmp_dir = $1 if ($tmp_dir =~ /(.*)/); $tmp_dir = $1 if ($tmp_dir =~ /(.*)/);
@ -89,12 +89,12 @@ sub hook_queue {
} }
print $tmp "HELO ", hostname(), "\n", print $tmp "HELO ", hostname(), "\n",
"MAIL FROM:<", ($txn->sender->address || ''), ">\n"; "MAIL FROM:<", ($transaction->sender->address || ''), ">\n";
print $tmp "RCPT TO:<", ($_->address || ''), ">\n" print $tmp "RCPT TO:<", ($_->address || ''), ">\n"
for $txn->recipients; for $transaction->recipients;
print $tmp "DATA\n", $txn->header->as_string; print $tmp "DATA\n", $transaction->header->as_string;
$txn->body_resetpos; $transaction->body_resetpos;
while (my $line = $txn->body_getline) { while (my $line = $transaction->body_getline) {
$line =~ s/^\./../; $line =~ s/^\./../;
print $tmp $line; print $tmp $line;
} }

View File

@ -251,18 +251,18 @@ sub evaluate {
} }
sub data_handler { sub data_handler {
my ($self, $txn) = @_; my ($self, $transaction) = @_;
my $l; my $l;
my $queries = 0; my $queries = 0;
my %pending; my %pending;
my @qp_continuations; my @qp_continuations;
$txn->body_resetpos; $transaction->body_resetpos;
while ($self->{check_headers} and $l = $txn->body_getline) { while ($self->{check_headers} and $l = $transaction->body_getline) {
chomp $l; chomp $l;
last if !$l; last if !$l;
} }
while ($l = $txn->body_getline) { while ($l = $transaction->body_getline) {
chomp $l; chomp $l;
if ($l =~ /(.*)=$/) { if ($l =~ /(.*)=$/) {
@ -378,7 +378,7 @@ sub data_handler {
} }
} }
} }
$txn->body_resetpos; $transaction->body_resetpos;
unless ($queries) { unless ($queries) {
$self->log(LOGINFO, "No URIs found in mail"); $self->log(LOGINFO, "No URIs found in mail");
@ -448,7 +448,7 @@ sub data_handler {
for (@matches) { for (@matches) {
$self->log(LOGWARN, $_->{desc}); $self->log(LOGWARN, $_->{desc});
if ($_->{action} eq 'add-header') { if ($_->{action} eq 'add-header') {
$txn->header->add('X-URIBL-Match', $_->{desc}); $transaction->header->add('X-URIBL-Match', $_->{desc});
} elsif ($_->{action} eq 'deny') { } elsif ($_->{action} eq 'deny') {
return (DENY, $_->{desc}); return (DENY, $_->{desc});
} elsif ($_->{action} eq 'denysoft') { } elsif ($_->{action} eq 'denysoft') {