new plugin output tracking

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@296 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Robert Spier 2004-09-04 03:16:10 +00:00
parent bdd20fed4d
commit 5128bd0718
2 changed files with 21 additions and 0 deletions

View File

@ -159,3 +159,14 @@ hook returned.
Returning DONE or OK will stop the next deny hook from being run. Returning DONE or OK will stop the next deny hook from being run.
DECLINED will make qpsmtpd run the remaining configured deny hooks. DECLINED will make qpsmtpd run the remaining configured deny hooks.
=head1 Return Values and Notes
Insert stuff here about how:
- if we're in a transaction, the results of a callback are stored
in
$self->transaction->notes( $code->{name})->{"hook_$hook"}->{return}
- if we're in a connection, store things in the connection notes instead.

View File

@ -232,6 +232,16 @@ sub run_hooks {
."running the $hook hook returned undef!") ."running the $hook hook returned undef!")
and next; and next;
if ($self->transaction) {
my $tnotes = $self->transaction->notes( $code->{name} );
$tnotes->{"hook_$hook"}->{'return'} = $r[0]
if (!defined $tnotes || ref $tnotes eq "HASH");
} else {
my $cnotes = $self->connection->notes( $code->{name} );
$cnotes->{"hook_$hook"}->{'return'} = $r[0]
if (!defined $cnotes || $cnotes eq "HASH");
}
# should we have a hook for "OK" too? # should we have a hook for "OK" too?
if ($r[0] == DENY or $r[0] == DENYSOFT) { if ($r[0] == DENY or $r[0] == DENYSOFT) {
$r[1] = "" if not defined $r[1]; $r[1] = "" if not defined $r[1];