[svn:qpsmtpd] rev 507 - in trunk: lib lib/Qpsmtpd t/plugin_tests

[email protected] 14 Jul 2005 13:31:08 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: msergeant
Date: Thu Jul 14 06:31:07 2005
New Revision: 507

Modified:
   trunk/lib/Qpsmtpd.pm
   trunk/lib/Qpsmtpd/Plugin.pm
   trunk/t/plugin_tests/dnsbl
Log:
MERGE 503:505 FROM https://svn.perl.org/qpsmtpd/branches/0.31

Fix test failures due to hook renames
Fix redefined warnings due to hook renames


Modified: trunk/lib/Qpsmtpd.pm
==============================================================================
--- trunk/lib/Qpsmtpd.pm	(original)
+++ trunk/lib/Qpsmtpd.pm	Thu Jul 14 06:31:07 2005
@@ -238,7 +238,7 @@ sub _load_plugins {
     my $package = "Qpsmtpd::Plugin::$plugin_name";
 
     # don't reload plugins if they are already loaded
-    unless ( defined &{"${package}::register"} ) {
+    unless ( defined &{"${package}::plugin_name"} ) {
       Qpsmtpd::Plugin->compile($plugin_name,
         $package, "$dir/$plugin", $self->{_test_mode});
       $self->log(LOGDEBUG, "Loading $plugin_line") 
@@ -320,9 +320,7 @@ sub run_hook {
   }
   else {
     $self->varlog(LOGINFO, $hook, $code->{name});
-    print STDERR "plugin $hook $code->{name} 1\n";
     eval { (@r) = $code->{code}->($self, $self->transaction, @args); };
-    print STDERR "plugin $hook $code->{name} 2\n";
     
     $@ and $self->log(LOGCRIT, "FATAL PLUGIN ERROR: ", $@) and return;
   

Modified: trunk/lib/Qpsmtpd/Plugin.pm
==============================================================================
--- trunk/lib/Qpsmtpd/Plugin.pm	(original)
+++ trunk/lib/Qpsmtpd/Plugin.pm	Thu Jul 14 06:31:07 2005
@@ -102,8 +102,8 @@ sub isa_plugin {
   $cleanParent =~ s/\W/_/g;
   my $newPackage = $currentPackage."::_isa_$cleanParent";
 
-
-  return if defined &{"${newPackage}::register"};
+  # don't reload plugins if they are already loaded
+  return if defined &{"${newPackage}::plugin_name"};
 
   $self->compile($self->plugin_name . "_isa_$cleanParent",
                     $newPackage,

Modified: trunk/t/plugin_tests/dnsbl
==============================================================================
--- trunk/t/plugin_tests/dnsbl	(original)
+++ trunk/t/plugin_tests/dnsbl	Thu Jul 14 06:31:07 2005
@@ -11,7 +11,7 @@ sub test_local {
     my $connection = $self->qp->connection;
     $connection->remote_ip('127.0.0.2'); # standard dnsbl test value
     
-    $self->connect_handler($self->qp->transaction);
+    $self->hook_connect($self->qp->transaction);
     
     ok($self->qp->connection->notes('dnsbl_sockets'));
 }
@@ -20,7 +20,7 @@ sub test_returnval {
     my $self = shift;
 
     my $address = Qpsmtpd::Address->parse('<[email protected]>');
-    my ($ret, $note) = $self->rcpt_handler($self->qp->transaction,
+    my ($ret, $note) = $self->hook_rcpt($self->qp->transaction,
       $address);
     is($ret, DENY, "Check we got a DENY");
     print("# dnsbl result: $note\n");