On 2006-07-15 22:13:23 +0200, Peter J. Holzer wrote:
> Addresses in Qpsmtpd are not simple strings, they are objects of class
> Qpsmtp::Address. We can add a method 'config' or 'notes' (or both) to
> this class. So the snippet from denysoft_greylist would become:
>
> return DECLINED unless $rcpt->config('denysoft_greylist');
>
> and - since the same object is returned by $transaction->recipients -
> you can use it the same way in the data_post hook:
>
> for ($transaction->recipients()) {
> if ($_->config('check_bayesian')) { ... }
> }
>
> There would probably have to be an additional hook (hook_address_config)
> for consistency with 'global' config.
While reading through some older plugins I found a different method for
per-user configs (I think this was invented by Gavin - at least the
per_recipient_config plugin was written by him):
Qpsmtpd->config has an optional second argument, $type. In the current
code this isn't passed to the config_hook. If it is (which is a one-line
change), it can be used to pass all kinds of optional information to the
hook, for example the recipient:
for ($self->qp->config('rhsbl_zones', { rcpt => $rcpt })) {
a config_hook plugin can then return different information depending on
the recipient.
AFAICS I wrote two plugins which use this mechanism. I don't remember
why I stopped using it. Maybe I thought my notes-based mechanism was
more elegant (although less flexible), or maybe I didn't want my plugins
to depend on a patch.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | [EMAIL PROTECTED] | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
pgpd0KMQ4o9Md.pgp
Description: PGP signature
