Hi Jared,

On Mon, 10 Nov 2008 10:42:15 -0600
Jared Johnson <[EMAIL PROTECTED]> wrote:
> * I invented my own Qpsmtpd::Recip object that subclasses 
> Qpsmtpd::Address and supports a ->config() method similar to 
> $self->qp->config
[...]
> Step 1:  Add per-recipient configuration
> 
> This in itself would probably be pretty simple to add support for and 
> would give plugin authors some immediate power.  Basically, one should 
> be able to call the 'config' method on a Qpsmtpd::Address object.  At 
> that point would become a bit of a misnomer; Qpsmtpd::Recipient might be 
> more appropriate.  This method should be able to get its values 
> similarly to qp->config:  from the file system or from a plugin.  I 
This looks like it can be done in a plugin and by adding a check for
the second parameter of Qpsmtpd::config(): 
 - in hook_rcpt replace the given Qpsmtpd::Address object by a 
   Qpsmtpd::Recipient object (similar to yours?). For replacing: see
   http://www.nntp.perl.org/group/perl.qpsmtpd/2008/10/msg8257.html
   You can also do 
     $_[0] = Qpsmtpd::Recipient->new($_[0]->user,$_[0]->host)
   without affecting anything... well, maybe except for setups where
   plugins replace the current Q::A object by another Q::A object
   instead of just setting ->user() and ->host(). 
      
 - Qpsmtpd::config(): if ($type and ref($type) != ""):  skip the
   $_config_cache lookup and pass the $type (in our case a
   Qpsmtpd::Recipient) to hook_config. 

This would mean that the core config is served from qmail files (or
hook_config) and all per recipient configs have to come from some
plugin hooking "config".

I, personally, would like to see some of the more common config
settings wrapped in config calls in Qpsmtpd::Recipient, like: 
$rcpt->queue (which queue plugin to use), ->spamassassin_enabled,
->sa_deny_score, ->drop (if true, drop message silently), ->redirect
(sent to this address if not undef())... i.e. anything which defines a
recipient and is probably useful for most users.

I'm currently working on a Qpsmtpd::Config module supporting some
backend config files transparently. I can add support for a second
parameter to support per recipient user/per domain configs and for a
whatever structured qmail file directory hierarchy [to Ask: also plugin
only ;-)]... as long as the given parameter supports ->user and ->host I
don't care if I get a Qpsmtpd::Address or a Qpsmtpd::Recipient. 
[ For configs stored in an SQL database the helper module probably needs
  some/much more work. ]

> Step 2:  Add per-recipient results
>
> A Qspmtpd::Address[|Recipient] object needs to have a method returning 
> its result, probably a Qpsmtpd::DSN object. 
...or some other flag based list what to do with the message (drop
silently, deny, accept, redirect, ...)?
[...]
> for my $rcpt ($transaction->recipients) {
>      next unless $rcpt->config('spamassassin_enabled');
>      my $score = scan();
Mhh, maybe ask the SA people if it's possible to scan one mail and then
switch user and just re-calculate the score for this user. This is
unlikely to work with spamd, but with a qpsmtpd plugin "use()ing"
Mail::SpamAssassin it may work.

        Hanno

Reply via email to