diff options
| author | fukachan <fukachan> | 2002-12-20 03:40:11 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-12-20 03:40:11 +0000 |
| commit | eebea87256b7cc29db4ff30166e1b465f7b554aa (patch) | |
| tree | 70cd10fa56b5eff2ef501bc7a686b21739046359 | |
| parent | 33cc3216e24c18b345adb828c8e3b3ba7e5ca920 (diff) | |
| download | fml8-eebea87256b7cc29db4ff30166e1b465f7b554aa.tar.gz fml8-eebea87256b7cc29db4ff30166e1b465f7b554aa.tar.bz2 fml8-eebea87256b7cc29db4ff30166e1b465f7b554aa.zip | |
fix comments and error messages.
add defined() more.
| -rw-r--r-- | fml/lib/FML/Command/Admin/chaddr.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/digest.pm | 39 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/file.pm | 6 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/get.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/htmlify.pm | 8 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/list.pm | 26 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/off.pm | 18 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/on.pm | 19 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/password.pm | 8 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/subscribe.pm | 12 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/unsubscribe.pm | 14 |
11 files changed, 109 insertions, 61 deletions
diff --git a/fml/lib/FML/Command/Admin/chaddr.pm b/fml/lib/FML/Command/Admin/chaddr.pm index ea28ec36..3f96029d 100644 --- a/fml/lib/FML/Command/Admin/chaddr.pm +++ b/fml/lib/FML/Command/Admin/chaddr.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: chaddr.pm,v 1.7 2002/09/11 23:18:07 fukachan Exp $ +# $FML: chaddr.pm,v 1.8 2002/09/22 14:56:44 fukachan Exp $ # package FML::Command::Admin::chaddr; @@ -33,7 +33,7 @@ change address from old one to new one. =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -89,18 +89,20 @@ sub process use FML::Credential; use FML::Log qw(Log LogWarn LogError); - # change all maps + # change all maps including this $address. my (@maps) = (); push(@maps, @$member_maps); push(@maps, @$recipient_maps); for my $map (@maps) { my $cred = new FML::Credential $curproc; + # XXX-TODO: this condition is correct ? + # XXX-TODO: we should remove old one when both old and new ones exist. # the current member/recipient file must have $old_address # but should not contain $new_address. if ($cred->has_address_in_map($map, $config, $old_address)) { unless ($cred->has_address_in_map($map, $config, $new_address)) { - # remove the old address. + # remove the old address only if $new_address not included. { my $obj = new IO::Adapter $map, $config; $obj->touch(); diff --git a/fml/lib/FML/Command/Admin/digest.pm b/fml/lib/FML/Command/Admin/digest.pm index 000a4f40..ea5f03c6 100644 --- a/fml/lib/FML/Command/Admin/digest.pm +++ b/fml/lib/FML/Command/Admin/digest.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: digest.pm,v 1.2 2002/11/23 13:12:47 fukachan Exp $ +# $FML: digest.pm,v 1.3 2002/12/10 12:00:49 fukachan Exp $ # package FML::Command::Admin::digest; @@ -13,9 +13,14 @@ use Carp; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +# +# XXX-TODO: clean up digest command more. +# + + =head1 NAME -FML::Command::Admin::digest - toggle digest mode off/on +FML::Command::Admin::digest - toggle digest mode to off/on. =head1 SYNOPSIS @@ -32,7 +37,7 @@ change digest mode for the specified address to off/on. =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -52,7 +57,7 @@ sub new sub need_lock { 1;} -# Descriptions: change on or off digest mode +# Descriptions: toggle delivery mode between real time and digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map,$digest_recipient_maps sub process @@ -71,7 +76,8 @@ sub process $config->get_as_array_ref('digest_recipient_maps'); # fundamental check - croak("address is not specified") unless defined $address; + croak("address not defined") unless defined $address; + croak("address not specified") unless $address; croak("primary_recipient_map not defined") unless defined $primary_recipient_map; croak("recipient_maps not defined") unless defined $recipient_maps; @@ -108,7 +114,7 @@ sub process } -# Descriptions: change to on mode +# Descriptions: change delivery mode to real time. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map sub _digest_on @@ -132,12 +138,13 @@ sub _digest_on maplist => [ $digest_recipient_map ], }; + # XXX-TODO: we expect userdel() and useradd() validate $address. $self->_userdel($curproc, $command_args, $uc_normal_args); $self->_useradd($curproc, $command_args, $uc_digest_args); } -# Descriptions: change to off mode +# Descriptions: change delivery mode to digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map sub _digest_off @@ -161,11 +168,17 @@ sub _digest_off maplist => $digest_recipient_maps, }; + # XXX-TODO: we expect userdel() and useradd() validate $address. $self->_userdel($curproc, $command_args, $uc_digest_args); $self->_useradd($curproc, $command_args, $uc_normal_args); } +# Descriptions: add the specified user. +# Arguments: OBJ($self) +# OBJ($curproc) HASH_REF($args) HASH_REF($uc_args) +# Side Effects: update address list(s). +# Return Value: none sub _useradd { my ($self, $curproc, $command_args, $uc_args) = @_; @@ -183,6 +196,11 @@ sub _useradd } +# Descriptions: remove the specified user. +# Arguments: OBJ($self) +# OBJ($curproc) HASH_REF($args) HASH_REF($uc_args) +# Side Effects: update address list(s). +# Return Value: none sub _userdel { my ($self, $curproc, $command_args, $uc_args) = @_; @@ -200,7 +218,7 @@ sub _userdel } -# Descriptions: show cgi menu for on +# Descriptions: show cgi menu. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map # Return Value: none @@ -209,6 +227,11 @@ sub cgi_menu my ($self, $curproc, $args, $command_args) = @_; my $r = ''; + # + # XXX-TODO: NOT IMPLEMENTED. + # + return; + eval q{ use FML::CGI::Admin::User; my $obj = new FML::CGI::Admin::User; diff --git a/fml/lib/FML/Command/Admin/file.pm b/fml/lib/FML/Command/Admin/file.pm index 9851e33f..ba653d8b 100644 --- a/fml/lib/FML/Command/Admin/file.pm +++ b/fml/lib/FML/Command/Admin/file.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: file.pm,v 1.6 2002/09/22 14:56:45 fukachan Exp $ +# $FML: file.pm,v 1.7 2002/11/23 15:20:00 fukachan Exp $ # package FML::Command::Admin::file; @@ -32,7 +32,7 @@ file a new address. =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -77,7 +77,7 @@ sub process my $regexp = $safe->basic_variable(); my $filereg = $regexp->{ file }; - # argv = command subcommand args ... + # argv = command subcommand args ... = command options my ($subcommand, @args)= @$options; if ($subcommand eq 'remove' || diff --git a/fml/lib/FML/Command/Admin/get.pm b/fml/lib/FML/Command/Admin/get.pm index 38d4850f..32db16c4 100644 --- a/fml/lib/FML/Command/Admin/get.pm +++ b/fml/lib/FML/Command/Admin/get.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: get.pm,v 1.15 2002/09/11 23:18:07 fukachan Exp $ +# $FML: get.pm,v 1.16 2002/09/22 14:56:45 fukachan Exp $ # package FML::Command::Admin::get; @@ -26,14 +26,14 @@ See C<FML::Command> for more details. =head1 DESCRIPTION -get arbitrary file(s) in $ml_home_dir +get arbitrary file(s) in $ml_home_dir. =head1 METHODS =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -64,7 +64,7 @@ sub process my ($self, $curproc, $command_args) = @_; my $config = $curproc->{ 'config' }; my $ml_home_dir = $config->{ ml_home_dir }; - my $command = $command_args->{ 'command' }; + my $command = $command_args->{ command }; my $options = $command_args->{ options }; # This module is called after @@ -76,6 +76,7 @@ sub process use File::Spec; my $filepath = File::Spec->catfile($ml_home_dir, $filename); + # XXX-TODO: we expect send_file() validates ${filename,filepath}. if (-f $filepath) { Log("send back $filename"); @@ -88,6 +89,7 @@ sub process delete $command_args->{ _filepath_to_send }; } else { + Log("$filename not found"); $curproc->reply_message_nl('error.no_such_file', "no such file $filename", { diff --git a/fml/lib/FML/Command/Admin/htmlify.pm b/fml/lib/FML/Command/Admin/htmlify.pm index 8053aab8..8303b100 100644 --- a/fml/lib/FML/Command/Admin/htmlify.pm +++ b/fml/lib/FML/Command/Admin/htmlify.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: htmlify.pm,v 1.18 2002/09/22 14:56:45 fukachan Exp $ +# $FML: htmlify.pm,v 1.19 2002/09/24 14:23:13 fukachan Exp $ # package FML::Command::Admin::htmlify; @@ -29,7 +29,7 @@ show user htmlify(s). =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -49,7 +49,7 @@ sub new sub need_lock { 0;} -# Descriptions: show the user htmlify +# Descriptions: convert article format from text to html. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: forward request to dir module # Return Value: none @@ -63,7 +63,7 @@ sub process my $debug = 0; unless ($config->yes('use_html_archive')) { - croak("html archive disabled"); + croak("html archive function disabled"); } print STDERR "htmlify\t$src_dir =>\n\t\t$dst_dir\n" if $debug; diff --git a/fml/lib/FML/Command/Admin/list.pm b/fml/lib/FML/Command/Admin/list.pm index 6373e2bc..e20d3540 100644 --- a/fml/lib/FML/Command/Admin/list.pm +++ b/fml/lib/FML/Command/Admin/list.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: list.pm,v 1.8 2002/09/11 23:18:07 fukachan Exp $ +# $FML: list.pm,v 1.9 2002/09/22 14:56:45 fukachan Exp $ # package FML::Command::Admin::list; @@ -20,7 +20,7 @@ FML::Command::Admin::list - show user list(s) =head1 SYNOPSIS -See C<FML::Command> for more detailist. +See C<FML::Command> for more details. =head1 DESCRIPTION @@ -29,7 +29,7 @@ show user list(s). =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -49,7 +49,7 @@ sub new sub need_lock { 0;} -# Descriptions: show the user list +# Descriptions: show the address list. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: forward request to dir module # Return Value: none @@ -70,7 +70,7 @@ sub process } -# Descriptions: show the address list +# Descriptions: show the address list. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # HASH_ARRAY($options) # Side Effects: none @@ -97,8 +97,8 @@ sub _show_list } # cheap sanity - unless (defined $maplist) { croak("list: map undeflined");} - unless ($maplist) { croak("list: map undeflined");} + unless (defined $maplist) { croak("list: map undefined");} + unless ($maplist) { croak("list: map unspecified");} # FML::Command::UserControl specific parameters my $uc_args = { @@ -119,19 +119,19 @@ sub _show_list } -# Descriptions: show cgi menu for subscribe +# Descriptions: show cgi menu. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map # Return Value: none sub cgi_menu { my ($self, $curproc, $args, $command_args) = @_; - my $map_default = $curproc->safe_param_map() || 'member'; - my $options = [ $map_default ]; - my $ml_name = $curproc->cgi_try_get_ml_name($args); - my $r = ''; + my $map_default = $curproc->safe_param_map() || 'member'; + my $options = [ $map_default ]; + my $ml_name = $curproc->cgi_try_get_ml_name($args); + my $r = ''; - # declare CGI mode + # declare CGI mode now. $command_args->{ is_cgi } = 1; # navigation bar diff --git a/fml/lib/FML/Command/Admin/off.pm b/fml/lib/FML/Command/Admin/off.pm index aabe9b9e..5f3be856 100644 --- a/fml/lib/FML/Command/Admin/off.pm +++ b/fml/lib/FML/Command/Admin/off.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: off.pm,v 1.2 2002/09/11 23:18:08 fukachan Exp $ +# $FML: off.pm,v 1.3 2002/09/22 14:56:45 fukachan Exp $ # package FML::Command::Admin::off; @@ -15,7 +15,7 @@ use Carp; =head1 NAME -FML::Command::Admin::off - change off mode specified member +FML::Command::Admin::off - change delivery mode from real time to digest. =head1 SYNOPSIS @@ -23,7 +23,7 @@ See C<FML::Command> for more details. =head1 DESCRIPTION -change off mode specified member +change delivery mode from real time to digest. =head1 METHODS @@ -32,7 +32,7 @@ change off mode specified member =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -52,7 +52,7 @@ sub new sub need_lock { 1;} -# Descriptions: change off mode specified member +# Descriptions: change delivery mode from real time to digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map # Return Value: none @@ -60,13 +60,16 @@ sub process { my ($self, $curproc, $command_args) = @_; my $config = $curproc->{ config }; + + # XXX-TODO: we should use $config->get_as_array_ref(). my @recipient_map = split(/\s+/, $config->{ recipient_maps }); my $options = $command_args->{ options }; my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address is not specified") unless defined $address; - croak("\@recipient_map is not specified") unless @recipient_map; + croak("address not defined") unless defined $address; + croak("address not specified") unless $address; + croak("\@recipient_map not specified") unless @recipient_map; # FML::Command::UserControl specific parameters my $uc_args = { @@ -75,6 +78,7 @@ sub process }; my $r = ''; + # XXX-TODO: we expect userdel() validates $address. eval q{ use FML::Command::UserControl; my $obj = new FML::Command::UserControl; diff --git a/fml/lib/FML/Command/Admin/on.pm b/fml/lib/FML/Command/Admin/on.pm index 621f555d..52ee87a5 100644 --- a/fml/lib/FML/Command/Admin/on.pm +++ b/fml/lib/FML/Command/Admin/on.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: on.pm,v 1.3 2002/09/11 23:18:08 fukachan Exp $ +# $FML: on.pm,v 1.4 2002/09/22 14:56:45 fukachan Exp $ # package FML::Command::Admin::on; @@ -15,7 +15,7 @@ use Carp; =head1 NAME -FML::Command::Admin::on - change on mode +FML::Command::Admin::on - change delivery mode from digest to real time =head1 SYNOPSIS @@ -23,7 +23,7 @@ See C<FML::Command> for more details. =head1 DESCRIPTION -change on mode address. +change delivery mode from digest to real time. =head1 METHODS @@ -32,7 +32,7 @@ change on mode address. =cut -# Descriptions: standard constructor +# Descriptions: constructor # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -52,7 +52,7 @@ sub new sub need_lock { 1;} -# Descriptions: change on mode +# Descriptions: change delivery mode from digest to real time. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map # Return Value: none @@ -60,13 +60,17 @@ sub process { my ($self, $curproc, $command_args) = @_; my $config = $curproc->{ config }; + + # XXX-TODO: use of $primary_recipient_map is correct here? my $recipient_map = $config->{ primary_recipient_map }; my $options = $command_args->{ options }; my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address is not specified") unless defined $address; - croak("\$recipient_map is not specified") unless $recipient_map; + croak("address not defined") unless defined $address; + croak("\$recipient_map not defined") unless defined $recipient_map; + croak("address not specified") unless $address; + croak("\$recipient_map not specified") unless $recipient_map; # FML::Command::UserControl specific parameters my $uc_args = { @@ -75,6 +79,7 @@ sub process }; my $r = ''; + # XXX-TODO: we expect useradd() validates $address. eval q{ use FML::Command::UserControl; my $obj = new FML::Command::UserControl; diff --git a/fml/lib/FML/Command/Admin/password.pm b/fml/lib/FML/Command/Admin/password.pm index 3853c8ff..527cd1c4 100644 --- a/fml/lib/FML/Command/Admin/password.pm +++ b/fml/lib/FML/Command/Admin/password.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: password.pm,v 1.3 2002/09/11 23:18:08 fukachan Exp $ +# $FML: password.pm,v 1.4 2002/09/22 14:56:46 fukachan Exp $ # package FML::Command::Admin::password; @@ -32,7 +32,7 @@ password a new address. =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -65,7 +65,9 @@ sub process # Though this module should be called after authentication, # this module is a module of authentication. - # dummary + # XXX-TODO: NOT IMPLEMNETED. + + # dummy return 1; } diff --git a/fml/lib/FML/Command/Admin/subscribe.pm b/fml/lib/FML/Command/Admin/subscribe.pm index 04254f0b..6df49808 100644 --- a/fml/lib/FML/Command/Admin/subscribe.pm +++ b/fml/lib/FML/Command/Admin/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.17 2002/09/11 23:18:08 fukachan Exp $ +# $FML: subscribe.pm,v 1.18 2002/09/22 14:56:46 fukachan Exp $ # package FML::Command::Admin::subscribe; @@ -29,10 +29,12 @@ subscribe a new address. =head2 C<process($curproc, $command_args)> +subscribe a new user. + =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -52,7 +54,7 @@ sub new sub need_lock { 1;} -# Descriptions: subscribe a new user +# Descriptions: subscribe a new user. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map # Return Value: none @@ -66,7 +68,8 @@ sub process my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address is not specified") unless defined $address; + croak("address is not defined") unless defined $address; + croak("address is not specified") unless $address; croak("\$member_map is not specified") unless $member_map; croak("\$recipient_map is not specified") unless $recipient_map; @@ -77,6 +80,7 @@ sub process }; my $r = ''; + # XXX-TODO: we expect useradd() validates $address. eval q{ use FML::Command::UserControl; my $obj = new FML::Command::UserControl; diff --git a/fml/lib/FML/Command/Admin/unsubscribe.pm b/fml/lib/FML/Command/Admin/unsubscribe.pm index b4c4cd10..e63eedd5 100644 --- a/fml/lib/FML/Command/Admin/unsubscribe.pm +++ b/fml/lib/FML/Command/Admin/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.16 2002/09/22 14:56:46 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.17 2002/12/15 13:46:29 fukachan Exp $ # package FML::Command::Admin::unsubscribe; @@ -29,10 +29,12 @@ remove the specified user. =head2 C<process($curproc, $command_args)> +remove the specified user. + =cut -# Descriptions: standard constructor +# Descriptions: constructor. # Arguments: OBJ($self) # Side Effects: none # Return Value: OBJ @@ -52,7 +54,7 @@ sub new sub need_lock { 1;} -# Descriptions: unsubscribe a new user +# Descriptions: remove the specified user. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map # Return Value: none @@ -60,13 +62,16 @@ sub process { my ($self, $curproc, $command_args) = @_; my $config = $curproc->{ config }; + + # XXX-TODO: use $config->get_as_array_ref(). my @member_map = split(/\s+/, $config->{ member_maps }); my @recipient_map = split(/\s+/, $config->{ recipient_maps }); my $options = $command_args->{ options }; my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address is not specified") unless defined $address; + croak("address is not defined") unless defined $address; + croak("address is not specified") unless $address; croak("\@member_map is not specified") unless @member_map; croak("\@recipient_map is not specified") unless @recipient_map; @@ -77,6 +82,7 @@ sub process }; my $r = ''; + # XXX-TODO: we expect userdel() validates $address. eval q{ use FML::Command::UserControl; my $obj = new FML::Command::UserControl; |
