Robin Bowes wrote:
This was why the original adaptive plugin hook'd reset_transaction; there isn't
hook after queue but before post-connection. I think that Johan's earlier
suggestion of looking at the transaction object to see which time you want the
logging to actually emit something (the middle reset_transaction, in other
words).
About 1 hour ago it would have saved me ... about 1 hour of hacking!
I was thinking and the other way to handle it would be to wrap the
original queue plugin and the put your code there, e.g. in config/plugins:
logging/queue_wrapper queue/qmail-queue
and in the queue_wrapper plugin itself:
sub init {
my ($self, $qp, $queue) = @_;
$self->isa_plugin($queue);
}
sub hook_queue {
my ($self, $transaction) = @_;
my $return = $self->SUPER::hook_queue($self, $transaction);
if ( $return == OK ) { # message was queued
# perform your logging activity
}
return $return;
}
*WARNING!!! NOT TESTED*
The only thing I haven't worked out is how to handle any optional
commandline arguments to the original queue plugin (which may just be a
matter of calling the original plugins init() sub with the appropriate @_).
HTH
John