On Wed, 09 Apr 2008 02:29:04 -0400
Matt Sergeant <[EMAIL PROTECTED]> wrote:

> Hanno Hecker wrote:
> > this patch sets a way to disable any loaded plugin(s) for the current
> > client. I'm not going to commit this before Ask released 0.43. Matt
[...] 
> I'm not sure this is the right way to do this. Surely you want something 
> in the transaction object that can "skip" plugins at run time? Yours 
I have something working which uses connection->notes, but there's much
more code running in the core during a connection (read: one extra
run_hooks() per hook).

> seems like a rather heavy hammer, which can be influenced in a very 
> bizarre cross connection manner.
Except for using this before the 'connect' hook, I don't see where. But
...(thinking loud) maybe use the plugins_loaded() and 
 ## Qpsmtpd.pm, run_continuation():
    $self->varlog(LOGDEBUG, $hook, $code->{name});
    my $tran = $self->transaction;
    next if $tran->plugin_disabled($code->{name}); ## new
    eval { (@r) = $code->{code}->($self, $tran, @$args); };

 ## Transaction.pm:
    my %disabled_plugins = ();
    sub plugin_disabled { $disabled_plugins{$_[1]}; }
    sub disable_plugin { $disabled_plugins{$_[1]} = 1; }
    sub enable_plugin { 
       delete $disabled_plugins{$_[1]} 
         if exists $disabled_plugins{$_[1]}; 
    }
Something like this?

Reply via email to