On Mon, 21 Jan 2008 12:33:52 -0600
Jared Johnson <[EMAIL PROTECTED]> wrote:
> Thanks for the previous responses and the excellent documentation -- 
> I've been really really happy with the way plugin writing works in QP 
> thus far.  I've written about 55 lines targeted to do all the somewhat 
> complex database logging that our application needs to do -- our 
> previous non-qp code uses at least a couple of hundred lines to do a 
> third as much logging.  I have run into a couple of hiccups though.
> 
> I've got a sub called from both hook_deny and hook_queue_post meant to 
> write the results of a transaction to our db (via our DBIx::Class magic):

> This works great for queued mail but has one obvious problem:  when a 
> hook_rcpt plugin like check_badrecipients blocks a recipient, 
> $transaction->recipients winds up having only the senders that were 
> *not* denied in it.  Is there some way for me to get ahold of the 
> recipient that was denied, other than modifying check_rcptto etc. to 
> pass this information in a note() or similar?
Hmm, you can wrap other plugins with your own code. At the end of
docs/plugins.pod (svn rev >= 829) is an example. With this you get DENYs
and others with just one plugin.

> There is also a less obvious problem:  $return turns out to be 901, even 
> though the return code issued to the smtp client by qpsmtpd is 550, and 
> that is the code we want to log.  Is this the appropriate behavior?
901 is the internal constant DENY, use 
  Qpsmtpd::Constant::return_code($value) 
to get the name if $value is numeric or the numerical value if
$value is a string like "DENY".
The actual response to the client depends on which hook you're in. 

If you really need the value, there's a hook_logging(). The lines which
are sent to the client are logged with LOGINFO (if not, please drop me
a note which lines are not logged with LOGINFO) and obviously match
/^[245]\d\d[\-\s]/. Not sure what $plugin is if the core logs
something :)

        Hanno

Reply via email to