diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index d8593d8..6d07d20 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -122,9 +122,15 @@ sub _config_from_file { return wantarray ? @config : $config[0]; } +our $HOOKS; + sub load_plugins { my $self = shift; - + + if ($HOOKS) { + return $self->{hooks} = $HOOKS; + } + $self->log(LOGERROR, "Plugins already loaded") if $self->{hooks}; $self->{hooks} = {}; @@ -135,6 +141,8 @@ sub load_plugins { @plugins = $self->_load_plugins($dir, @plugins); + $HOOKS = $self->{hooks}; + return @plugins; }