On 2004-09-25 11:54:22 +0200, Michael Holzt wrote: > > >This is what my proposed "conf" hook would allow. > > And like magic, there already is a config hook :-) > > Yes, after having some hours of sleep and with the hint in the > other mail i found out about that too :-) > > But currently it seems unable to fulfill my requirements. The > config hook plugin does not get told which plugin is requiring > the configuration, which hook we are in and does not get the > transaction-object.
It does get the transaction object. Looking at Gavin's per_recipient_config plugin, the signature of the config hook is: sub per_recipient_config { my ($self, $transaction, $config, $arg) = @_; I don't quite see why a config hook plugin should have to know from which plugin or hook it is called. Writing config plugins in such a way that they know from which plugins in which situation they are called seems terribly convoluted to me. Every information from the called should be passed via $config and $arg. Especially $arg, being a hash reference, can pass on arbitrarily complex data structures. So you can do something like: $self->qp->config("my_plugin/category1/parameter2", { plugin => ref($self), hook => "rcpt", rcpt => $rcpt, foo => [ qw(baz gazonk) ], } ); > I will have a look into that and will add > it, if i can figure it out. I believe there are currently no > conf plugins, so i won't break anything. There are at least 2: http_config and per_recipient_config. > One problem remains even after having done that: I still believe > that a conf plugin called by an rcpt hook will not be able to > get the recipient in question through the transaction-object > because it is not already in it, or is it? Right. It has to be passed explicitely via $arg. I'm not completely happy with this, but it is more flexible. For example, you can also query the configuration for a different address than for the current recipient (for example, I wrote a plugin which checks if the sender is a local user and takes some action depending on that). hp -- _ | Peter J. Holzer | Je höher der Norden, desto weniger wird |_|_) | Sysadmin WSR | überhaupt gesprochen, also auch kein Dialekt. | | | [EMAIL PROTECTED] | Hallig Gröde ist fast gänzlich dialektfrei. __/ | http://www.hjp.at/ | -- Hannes Petersen in desd
pgpvT5SDHeo33.pgp
Description: PGP signature