2002-07-06 09:18:48 +02:00
|
|
|
package Qpsmtpd::Plugin;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $proto = shift;
|
|
|
|
my $class = ref($proto) || $proto;
|
2002-07-08 04:30:11 +02:00
|
|
|
my %args = @_;
|
|
|
|
bless ({ _qp => $args{qpsmtpd} }, $class);
|
2002-07-06 09:18:48 +02:00
|
|
|
}
|
|
|
|
|
2002-07-08 04:30:11 +02:00
|
|
|
sub register_hook {
|
|
|
|
my ($plugin, $hook, $method) = @_;
|
|
|
|
# I can't quite decide if it's better to parse this code ref or if
|
|
|
|
# we should pass the plugin object and method name ... hmn.
|
|
|
|
$plugin->qp->_register_hook($hook, sub { $plugin->$method(@_) });
|
|
|
|
}
|
2002-07-06 09:18:48 +02:00
|
|
|
|
2002-07-08 04:30:11 +02:00
|
|
|
sub qp {
|
|
|
|
shift->{_qp};
|
|
|
|
}
|
2002-07-06 09:18:48 +02:00
|
|
|
|
2002-07-08 04:30:11 +02:00
|
|
|
sub log {
|
|
|
|
shift->qp->log(@_);
|
2002-07-06 09:18:48 +02:00
|
|
|
}
|
|
|
|
|
2002-07-08 04:30:11 +02:00
|
|
|
sub transaction {
|
|
|
|
# not sure if this will work in a non-forking or a threaded daemon
|
|
|
|
shift->qp->transaction;
|
|
|
|
}
|
2002-07-06 09:18:48 +02:00
|
|
|
|
|
|
|
1;
|