diff options
| author | fukachan <fukachan> | 2003-04-29 11:28:05 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-04-29 11:28:05 +0000 |
| commit | 6362cd845b5980df46ba554340ee35b2057d8da4 (patch) | |
| tree | 8318daf3f93e0823ed55b746eb9d86650022469d /fml/lib/FML/Process/Error.pm | |
| parent | f23f4e6944fada9b2039478f76865fafa29f1fe2 (diff) | |
| download | fml8-6362cd845b5980df46ba554340ee35b2057d8da4.tar.gz fml8-6362cd845b5980df46ba554340ee35b2057d8da4.tar.bz2 fml8-6362cd845b5980df46ba554340ee35b2057d8da4.zip | |
o define sender as $maintainer as a dummy sender to avoid unexpected error.
o if $maintainer_recipient_maps defined, forward error message to it.
Diffstat (limited to 'fml/lib/FML/Process/Error.pm')
| -rw-r--r-- | fml/lib/FML/Process/Error.pm | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/fml/lib/FML/Process/Error.pm b/fml/lib/FML/Process/Error.pm index 59a23285..6b40a83c 100644 --- a/fml/lib/FML/Process/Error.pm +++ b/fml/lib/FML/Process/Error.pm @@ -3,7 +3,7 @@ # Copyright (C) 2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Error.pm,v 1.28 2003/02/18 15:57:46 fukachan Exp $ +# $FML: Error.pm,v 1.29 2003/03/16 07:26:22 fukachan Exp $ # package FML::Process::Error; @@ -107,11 +107,18 @@ dummy. sub verify_request { my ($curproc, $args) = @_; - my $config = $curproc->{ config }; + my $config = $curproc->{ config }; + my $maintainer = $config->{ maintainer }; my $eval = $config->get_hook( 'error_verify_request_start_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + # set dummy sender to avoid unexpected error + use FML::Credential; + my $cred = new FML::Credential $curproc; + $curproc->{'credential'} = $cred; + $curproc->{'credential'}->set( 'sender', $maintainer ); + $eval = $config->get_hook( 'error_verify_request_end_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } } @@ -146,6 +153,8 @@ sub run my $eval = $config->get_hook( 'error_run_start_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + $curproc->_forward_error_message(); + unless ($curproc->is_refused()) { eval q{ use Mail::Bounce; @@ -272,11 +281,46 @@ sub finish Log("error message not found"); } + $curproc->inform_reply_messages(); + $curproc->queue_flush(); + $eval = $config->get_hook( 'error_finish_end_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } } +=head1 message forwarding + +=cut + + +# Descriptions: forward error message on rejection. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($msg_args) +# Side Effects: update reply message queue +# Return Value: none +sub _forward_error_message +{ + my ($curproc) = @_; + my $config = $curproc->config(); + my $maintainer = $config->{ maintainer }; + my $maps = $config->{ maintainer_recipient_maps } || ''; + my $msg = $curproc->incoming_message(); + + if ($maps) { + my $maps = $config->get_as_array_ref('maintainer_recipient_maps'); + my $msg_args = { + sender => $maintainer, + recipient_maps => $maps, + header => { + from => $maintainer, + to => $maintainer, + }, + }; + $curproc->reply_message($msg, $msg_args); + } +} + + =head1 CODING STYLE See C<http://www.fml.org/software/FNF/> on fml coding style guide. |
