On 2008-11-14 19:19:01 +0100, Hanno Hecker wrote:
> 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(): 

Take a look at
http://svn.perl.org/viewvc/qpsmtpd/contrib/hjp/address_notes/

It adds a notes() method to the Qpsmtpd::Address class which works
just the same the transaction and connection notes.


>  - 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(). 

Or where the Q::A object contains more state than just user and host.

> 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 do almost all of these with address notes. (Some older plugins still
use transaction notes with the recipient address as part of the key, I
should really update them ...).

And I guess I should have moved address_notes from contrib to trunk long
ago. It's really useful, fits into the model of qpsmtpd, and nobody
looks in contrib before reinventing the wheel ;-(.

        hp

-- 
   _  | Peter J. Holzer    | Openmoko has already embedded
|_|_) | Sysadmin WSR       | voting system.
| |   | [EMAIL PROTECTED]         | Named "If you want it -- write it"
__/   | http://www.hjp.at/ |  -- Ilja O. on [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to