On Sun Apr 05, 2009 at 23:44:12 +0000, b-sub-564...@rope.net wrote:

> Clear as mud?

  Pretty much :)

> What I am thinking of doing is to have my routine return DECLINED after
> identifying something to sideline, then set a note. The note would be read
> by queue/qmail-queue and, if set, just silently drop it. Hopefully a minor
> kludge to qmail-queue.

  (Set the note *then* return, I'm sure?)

> Or is it possible to tell the sender, at this point, that the message was
> accepted, but not pass it on to qmail-queue?

  The acceptance will only happen at the queue stage so you cannot tell
 the client the message was accepted before then.

  The following example should be sufficient and allow you to do everything
 in one plugin - without the need to modify the queue/qmail-queue plugin
 at all - but it might be cleaner to modify that if you do similar things
 in multiple plugins.

  Just make sure this plugin is loaded before the other - or it will run 
 too late.

=begin doc

  Trivial plugin to avoid empty messages.  Only for example purposes.

=end doc

=cut

sub hook_data_post
{
    my ( $self, $transaction ) = @_;

    if ( $transaction->body_size == 0 )
    {
        $transaction->notes( "swallow", 1 );
        $transaction->notes( "reason", "no data sent" );
        $self->log( LOGWARN, "No data received" );
        return DECLINED;
    }
}

=begin doc

  Pretend to accept messages which have been marked "swallow".

=end doc

=cut 

sub hook_queue
{
    my( $self, $transaction ) =  ( @_) ;

    if ( 1 == ( $transaction->notes("swallow") || 0 ) )
    {
        my $reason = $transaction->notes( "reason" ) || "Queued!";
        return ( OK, $reason );
    }
    return DECLINED;
}


Steve
-- 
Managed Anti-Spam Service
http://mail-scanning.com/

Reply via email to