summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-03-06 14:13:27 +0000
committerfukachan <fukachan>2003-03-06 14:13:27 +0000
commit34bd1f7b1d5c4fdcd9b4d2ce2c49eee21d4bb33d (patch)
tree6037a9e5c01ae68fc2760b6481ba4f04fe46429f /fml/lib
parent179ed66cbfbe6c35f20cdbd021ce82f8ca0b2d17 (diff)
downloadfml8-34bd1f7b1d5c4fdcd9b4d2ce2c49eee21d4bb33d.tar.gz
fml8-34bd1f7b1d5c4fdcd9b4d2ce2c49eee21d4bb33d.tar.bz2
fml8-34bd1f7b1d5c4fdcd9b4d2ce2c49eee21d4bb33d.zip
implment new method convert_to_mail_address() and use it
to expand {admin, sender, ...} to the corresponding mail address.
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Filter.pm15
-rw-r--r--fml/lib/FML/Process/Utils.pm41
2 files changed, 52 insertions, 4 deletions
diff --git a/fml/lib/FML/Filter.pm b/fml/lib/FML/Filter.pm
index 233abb98..5adef239 100644
--- a/fml/lib/FML/Filter.pm
+++ b/fml/lib/FML/Filter.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Filter.pm,v 1.22 2003/03/05 15:10:42 fukachan Exp $
+# $FML: Filter.pm,v 1.23 2003/03/05 15:47:21 fukachan Exp $
#
package FML::Filter;
@@ -244,8 +244,17 @@ send back message on rejection, with reason if could.
sub article_filter_reject_notice
{
my ($self, $curproc, $msg_args) = @_;
- my $msg = $curproc->incoming_message();
- my $r = $msg_args->{ _arg_reason } || 'unknown';
+ my $config = $curproc->config();
+ my $msg = $curproc->incoming_message();
+ my $r = $msg_args->{ _arg_reason } || 'unknown';
+
+ # recipients
+ my $list =
+ $config->get_as_array_ref('article_filter_reject_notice_recipients');
+ my $rcpts = $curproc->convert_to_mail_address($list);
+ $msg_args->{ recipient } = $rcpts;
+
+ Log("filter notice: [ @$rcpts ]");
$curproc->reply_message_nl("error.reject_post",
"your post is rejected.",
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm
index 25419394..09dee4df 100644
--- a/fml/lib/FML/Process/Utils.pm
+++ b/fml/lib/FML/Process/Utils.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Utils.pm,v 1.60 2003/02/16 08:55:42 fukachan Exp $
+# $FML: Utils.pm,v 1.61 2003/02/20 04:32:50 fukachan Exp $
#
package FML::Process::Utils;
@@ -1112,6 +1112,45 @@ sub which_map_nl
}
+=head2 convert_to_mail_address($list)
+
+convert_to_mail_address() converts $list to mail addresses.
+For example
+
+ admin => $maintainer
+ sender => sender of the current message (From: in header)
+
+=cut
+
+
+# Descriptions: convert to mail addresses.
+# Arguments: OBJ($curproc) ARRAY_REF($list)
+# Side Effects: none
+# Return Value: ARRAY_REF
+sub convert_to_mail_address
+{
+ my ($curproc, $list) = @_;
+ my $config = $curproc->config();
+ my $cred = $curproc->{ credential };
+ my $result = [];
+
+ for my $rcpt (@$list) {
+ if ($rcpt eq 'admin') {
+ push(@$result, $config->{ maintainer });
+ }
+ elsif ($rcpt eq 'sender') {
+ my $sender = $cred->sender();
+ push(@$result, $sender);
+ }
+ else {
+ LogError("unknown recipient type $rcpt");
+ }
+ }
+
+ return $result;
+}
+
+
=head2 article_id_max()
return the current article number (sequence number).