Version 0.31 branch
git-svn-id: https://svn.perl.org/qpsmtpd/branches/v031@480 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
90daeb3786
commit
a1324b5ddb
@ -16,6 +16,7 @@ use APR::Bucket ();
|
|||||||
use APR::Socket ();
|
use APR::Socket ();
|
||||||
use Apache2::Filter ();
|
use Apache2::Filter ();
|
||||||
use ModPerl::Util ();
|
use ModPerl::Util ();
|
||||||
|
use Apache::Scoreboard;
|
||||||
|
|
||||||
our $VERSION = '0.02';
|
our $VERSION = '0.02';
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ use vars qw($VERSION $Logger $TraceLevel $Spool_dir);
|
|||||||
|
|
||||||
use Sys::Hostname;
|
use Sys::Hostname;
|
||||||
use Qpsmtpd::Constants;
|
use Qpsmtpd::Constants;
|
||||||
|
use Qpsmtpd::Transaction;
|
||||||
|
use Qpsmtpd::Connection;
|
||||||
|
|
||||||
$VERSION = "0.31-dev";
|
$VERSION = "0.31-dev";
|
||||||
|
|
||||||
@ -114,17 +116,25 @@ sub config_dir {
|
|||||||
my $configdir = ($ENV{QMAIL} || '/var/qmail') . '/control';
|
my $configdir = ($ENV{QMAIL} || '/var/qmail') . '/control';
|
||||||
my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
|
my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
|
||||||
$configdir = "$name/config" if (-e "$name/config/$config");
|
$configdir = "$name/config" if (-e "$name/config/$config");
|
||||||
|
if (exists $ENV{QPSMTPD_CONFIG}) {
|
||||||
|
$configdir = $ENV{QPSMTPD_CONFIG} if (-e "$ENV{QPSMTPD_CONFIG}/$config");
|
||||||
|
}
|
||||||
return $configdir;
|
return $configdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub plugin_dir {
|
sub plugin_dir {
|
||||||
|
my $self = shift;
|
||||||
|
my $plugin_dir = $self->config('plugin_dir', "NOLOG");
|
||||||
|
unless (defined($plugin_dir)) {
|
||||||
my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
|
my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
|
||||||
my $dir = "$name/plugins";
|
$plugin_dir = "$name/plugins";
|
||||||
|
}
|
||||||
|
return $plugin_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_qmail_config {
|
sub get_qmail_config {
|
||||||
my ($self, $config, $type) = @_;
|
my ($self, $config, $type) = @_;
|
||||||
$self->log(LOGDEBUG, "trying to get config for $config");
|
$self->log(LOGDEBUG, "trying to get config for $config") unless $type and $type eq "NOLOG";
|
||||||
if ($self->{_config_cache}->{$config}) {
|
if ($self->{_config_cache}->{$config}) {
|
||||||
return wantarray ? @{$self->{_config_cache}->{$config}} : $self->{_config_cache}->{$config}->[0];
|
return wantarray ? @{$self->{_config_cache}->{$config}} : $self->{_config_cache}->{$config}->[0];
|
||||||
}
|
}
|
||||||
@ -246,10 +256,6 @@ sub _load_plugins {
|
|||||||
return @ret;
|
return @ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub transaction {
|
|
||||||
return {}; # base class implements empty transaction
|
|
||||||
}
|
|
||||||
|
|
||||||
sub run_hooks {
|
sub run_hooks {
|
||||||
my ($self, $hook) = (shift, shift);
|
my ($self, $hook) = (shift, shift);
|
||||||
my $hooks = $self->{hooks};
|
my $hooks = $self->{hooks};
|
||||||
@ -347,6 +353,22 @@ sub spool_dir {
|
|||||||
return $Spool_dir;
|
return $Spool_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub transaction {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->{_transaction} || $self->reset_transaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub reset_transaction {
|
||||||
|
my $self = shift;
|
||||||
|
$self->run_hooks("reset_transaction") if $self->{_transaction};
|
||||||
|
return $self->{_transaction} = Qpsmtpd::Transaction->new();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub connection {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->{_connection} || ($self->{_connection} = Qpsmtpd::Connection->new());
|
||||||
|
}
|
||||||
|
|
||||||
# For unique filenames. We write to a local tmp dir so we don't need
|
# For unique filenames. We write to a local tmp dir so we don't need
|
||||||
# to make them unpredictable.
|
# to make them unpredictable.
|
||||||
my $transaction_counter = 0;
|
my $transaction_counter = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user