diff options
| author | fukachan <fukachan> | 2004-03-13 11:46:32 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-03-13 11:46:32 +0000 |
| commit | a1401345e5a22c92d0f325dc8f8b00b2279dc0b9 (patch) | |
| tree | b5bff0398136b0a54a9f8dd5f17015132f0eeabb /fml/lib | |
| parent | 62318e6f2ef21ea01483fc569dee0e199970e0c3 (diff) | |
| download | fml8-a1401345e5a22c92d0f325dc8f8b00b2279dc0b9.tar.gz fml8-a1401345e5a22c92d0f325dc8f8b00b2279dc0b9.tar.bz2 fml8-a1401345e5a22c92d0f325dc8f8b00b2279dc0b9.zip | |
fml --allow-send-message allows makefml/fml sends reply messages.
currently user mode "subscribe" and "unsubcribe" support this style.
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Command/User/subscribe.pm | 18 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/unsubscribe.pm | 18 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Configure.pm | 29 |
3 files changed, 55 insertions, 10 deletions
diff --git a/fml/lib/FML/Command/User/subscribe.pm b/fml/lib/FML/Command/User/subscribe.pm index d933e046..9565f631 100644 --- a/fml/lib/FML/Command/User/subscribe.pm +++ b/fml/lib/FML/Command/User/subscribe.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: subscribe.pm,v 1.25 2004/02/15 04:38:31 fukachan Exp $ +# $FML: subscribe.pm,v 1.26 2004/02/24 14:36:53 fukachan Exp $ # package FML::Command::User::subscribe; @@ -85,11 +85,21 @@ sub process my $cache_dir = $config->{ db_dir }; my $keyword = $config->{ confirm_command_prefix }; my $command = $command_args->{ command }; - my $address = $cred->sender(); + my $options = $command_args->{ options }; + my $address = + $command_args->{ command_data } || $options->[ 0 ] || $cred->sender(); # fundamental check - croak("\$member_map is not specified") unless $member_map; - croak("\$recipient_map is not specified") unless $recipient_map; + croak("\$member_map unspecified") unless $member_map; + croak("\$recipient_map unspecified") unless $recipient_map; + croak("\$address unspecified") unless $address; + + # XXX extension: fml --allow-send-message or fml --allow-reply-message + unless ($cred->sender()) { + if ($curproc->allow_reply_message()) { + $cred->set_sender($address); + } + } # exatct match as could as possible. my $compare_level = $cred->get_compare_level(); diff --git a/fml/lib/FML/Command/User/unsubscribe.pm b/fml/lib/FML/Command/User/unsubscribe.pm index 24ce8ab3..ce0ef478 100644 --- a/fml/lib/FML/Command/User/unsubscribe.pm +++ b/fml/lib/FML/Command/User/unsubscribe.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: unsubscribe.pm,v 1.26 2004/02/15 04:38:31 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.27 2004/02/24 14:36:53 fukachan Exp $ # package FML::Command::User::unsubscribe; @@ -84,11 +84,21 @@ sub process my $cache_dir = $config->{ db_dir }; my $keyword = $config->{ confirm_command_prefix }; my $command = $command_args->{ command }; - my $address = $cred->sender(); + my $options = $command_args->{ options }; + my $address = + $command_args->{ command_data } || $options->[ 0 ] || $cred->sender(); # cheap sanity checks - croak("\$member_map is not specified") unless $member_map; - croak("\$recipient_map is not specified") unless $recipient_map; + croak("\$member_map unspecified") unless $member_map; + croak("\$recipient_map unspecified") unless $recipient_map; + croak("\$address unspecified") unless $address; + + # XXX extension: fml --allow-send-message or fml --allow-reply-message + unless ($cred->sender()) { + if ($curproc->allow_reply_message()) { + $cred->set_sender($address); + } + } # exatct match as could as possible. my $compare_level = $cred->get_compare_level(); diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm index c02d2237..9c87aafb 100644 --- a/fml/lib/FML/Process/Configure.pm +++ b/fml/lib/FML/Process/Configure.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002,2003,2004 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Configure.pm,v 1.62 2004/01/24 15:37:02 fukachan Exp $ +# $FML: Configure.pm,v 1.63 2004/01/31 04:06:32 fukachan Exp $ # package FML::Process::Configure; @@ -153,6 +153,12 @@ sub finish my $eval = $config->get_hook( 'makefml_finish_start_hook' ); if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } + # --allow-send-message or --allow-reply-message option specified. + if ($curproc->allow_reply_message()) { + $curproc->inform_reply_messages(); + $curproc->queue_flush(); + } + $eval = $config->get_hook( 'makefml_finish_end_hook' ); if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -293,8 +299,10 @@ sub _makefml # build arguments to pass off to each method. # XXX-TODO: command = [ $method, @options ]; ? (no, used only for message?) + my $option = $curproc->command_line_options(); + my $command_mode = $curproc->__get_command_mode($option); my $command_args = { - command_mode => 'admin', + command_mode => $command_mode, comname => $method, command => "$method @options", ml_name => $ml_name, @@ -342,6 +350,23 @@ sub _makefml } +# Descriptions: determine command mode. +# Arguments: OBJ($curproc) HASH_REF($option) +# Side Effects: none +# Return Value: STR +sub __get_command_mode +{ + my ($curproc, $option) = @_; + + if (defined $option->{ mode } && $option->{ mode } =~ /^user$/i) { + return 'user'; + } + else { + return 'admin'; + } +} + + =head1 CODING STYLE See C<http://www.fml.org/software/FNF/> on fml coding style guide. |
