diff options
| author | fukachan <fukachan> | 2002-02-11 10:59:36 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-02-11 10:59:36 +0000 |
| commit | 05b70a24fddac428ea9eb3b84bff134bcb5f2484 (patch) | |
| tree | 0365b6f494a8e58addb208563111f7929f83f843 | |
| parent | 2a25d6a9bf91239a4c8f73998b8909e8fcfbe4fe (diff) | |
| download | fml8-05b70a24fddac428ea9eb3b84bff134bcb5f2484.tar.gz fml8-05b70a24fddac428ea9eb3b84bff134bcb5f2484.tar.bz2 fml8-05b70a24fddac428ea9eb3b84bff134bcb5f2484.zip | |
send back file file in $ml_home_dir if found.
return the default message if not found.
"guide", "help", "objective" commands use this logic.
| -rw-r--r-- | fml/lib/FML/Command/SendFile.pm | 35 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/deny.pm | 72 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/guide.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/help.pm | 17 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/objective.pm | 72 |
5 files changed, 185 insertions, 21 deletions
diff --git a/fml/lib/FML/Command/SendFile.pm b/fml/lib/FML/Command/SendFile.pm index c85a1733..904a3688 100644 --- a/fml/lib/FML/Command/SendFile.pm +++ b/fml/lib/FML/Command/SendFile.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: SendFile.pm,v 1.8 2002/01/27 09:23:55 fukachan Exp $ +# $FML: SendFile.pm,v 1.9 2002/01/30 15:32:24 fukachan Exp $ # package FML::Command::SendFile; @@ -201,6 +201,39 @@ sub send_file } +=head2 C<send_user_xxx_message($curproc, $command_args, $type)> + +Send back a help file if "help" is found in $ml_home_dir +(e.g. /var/spool/ml/elena) for backward compatibility. +Sebd back the default help message if not found. + +=cut + + +# Descriptions: send back file file in $ml_home_dir if found. +# return the default message if not found. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) STR($type) +# Side Effects: put the message into the mail queue +# Return Value: none +sub send_user_xxx_message +{ + my ($self, $curproc, $command_args, $type) = @_; + my $config = $curproc->{ config }; + + # if "help" is found in $ml_home_dir (e.g. /var/spool/ml/elena), + # send it. + if (-f $config->{ "${type}_file" }) { + $command_args->{ _file_to_send } = $config->{ "${type}_file" }; + $self->send_file($curproc, $command_args); + } + # if "help" is not found, use the default help message. + else { + $curproc->reply_message_nl("help.user.${type}", + "${type} unavailable (error)."); + } +} + + =head1 AUTHOR Ken'ichi Fukamachi diff --git a/fml/lib/FML/Command/User/deny.pm b/fml/lib/FML/Command/User/deny.pm new file mode 100644 index 00000000..cc950f31 --- /dev/null +++ b/fml/lib/FML/Command/User/deny.pm @@ -0,0 +1,72 @@ +#-*- perl -*- +# +# Copyright (C) 2001,2002 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: deny.pm,v 1.8 2002/02/11 10:24:13 fukachan Exp $ +# + +package FML::Command::User::deny; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +use FML::Command::SendFile; +use FML::Log qw(Log LogWarn LogError); +@ISA = qw(FML::Command::SendFile FML::Command::Utils ErrorStatus); + + +=head1 NAME + +FML::Command::User::deny - send back deny file + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +See C<FML::Command> for more details. + +=head1 METHODS + +=head2 C<process($curproc, $command_args)> + +=cut + + +# Descriptions: send file by FML::Command::SendFile. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: none +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + + $self->send_user_xxx_message($curproc, $command_args, "deny"); +} + + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2001 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::User::deny appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/User/guide.pm b/fml/lib/FML/Command/User/guide.pm index 8ac9b62c..79c39195 100644 --- a/fml/lib/FML/Command/User/guide.pm +++ b/fml/lib/FML/Command/User/guide.pm @@ -1,10 +1,10 @@ #-*- perl -*- # -# Copyright (C) 2001 Ken'ichi Fukamachi +# Copyright (C) 2001,2002 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: guide.pm,v 1.3 2001/12/22 09:21:04 fukachan Exp $ +# $FML: guide.pm,v 1.8 2002/02/11 10:24:13 fukachan Exp $ # package FML::Command::User::guide; @@ -29,7 +29,7 @@ See C<FML::Command> for more details. =head1 DESCRIPTION -send back file. +See C<FML::Command> for more details. =head1 METHODS @@ -45,10 +45,8 @@ send back file. sub process { my ($self, $curproc, $command_args) = @_; - my $config = $curproc->{ config }; - $command_args->{ _file_to_send } = $config->{ "guide_file" }; - $self->send_file($curproc, $command_args); + $self->send_user_xxx_message($curproc, $command_args, "guide"); } diff --git a/fml/lib/FML/Command/User/help.pm b/fml/lib/FML/Command/User/help.pm index deef1c8f..62d55796 100644 --- a/fml/lib/FML/Command/User/help.pm +++ b/fml/lib/FML/Command/User/help.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: help.pm,v 1.7 2001/12/22 16:10:51 fukachan Exp $ +# $FML: help.pm,v 1.8 2002/02/11 10:24:13 fukachan Exp $ # package FML::Command::User::help; @@ -45,19 +45,8 @@ See C<FML::Command> for more details. sub process { my ($self, $curproc, $command_args) = @_; - my $config = $curproc->{ config }; - - # if "help" is found in $ml_home_dir (e.g. /var/spool/ml/elena), - # send it. - if (-f $config->{ "help_file" }) { - $command_args->{ _file_to_send } = $config->{ "help_file" }; - $self->send_file($curproc, $command_args); - } - # if "help" is not found, use the default help message. - else { - $curproc->reply_message_nl('help.user.help', - "help unavailable (error)."); - } + + $self->send_user_xxx_message($curproc, $command_args, "help"); } diff --git a/fml/lib/FML/Command/User/objective.pm b/fml/lib/FML/Command/User/objective.pm new file mode 100644 index 00000000..337f7204 --- /dev/null +++ b/fml/lib/FML/Command/User/objective.pm @@ -0,0 +1,72 @@ +#-*- perl -*- +# +# Copyright (C) 2001,2002 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: objective.pm,v 1.8 2002/02/11 10:24:13 fukachan Exp $ +# + +package FML::Command::User::objective; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +use FML::Command::SendFile; +use FML::Log qw(Log LogWarn LogError); +@ISA = qw(FML::Command::SendFile FML::Command::Utils ErrorStatus); + + +=head1 NAME + +FML::Command::User::objective - send back objective file + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +See C<FML::Command> for more details. + +=head1 METHODS + +=head2 C<process($curproc, $command_args)> + +=cut + + +# Descriptions: send file by FML::Command::SendFile. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: none +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + + $self->send_user_xxx_message($curproc, $command_args, "objective"); +} + + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2001 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::User::objective appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; |
