diff options
| author | fukachan <fukachan> | 2002-03-24 11:26:44 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-03-24 11:26:44 +0000 |
| commit | 7300273b63deb72226245e06afae952ecb7cb5aa (patch) | |
| tree | 45bad188273a5f1297e49849d3f8bb97fa1d5a57 | |
| parent | b2a3ca8e02584787d674b926c121bdbb6bd706e3 (diff) | |
| download | fml8-7300273b63deb72226245e06afae952ecb7cb5aa.tar.gz fml8-7300273b63deb72226245e06afae952ecb7cb5aa.tar.bz2 fml8-7300273b63deb72226245e06afae952ecb7cb5aa.zip | |
support admin {dir,ls} command
| -rw-r--r-- | fml/lib/FML/Command/Admin/dir.pm | 116 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/ls.pm | 61 | ||||
| -rw-r--r-- | fml/lib/FML/Command/DirUtils.pm | 116 |
3 files changed, 293 insertions, 0 deletions
diff --git a/fml/lib/FML/Command/Admin/dir.pm b/fml/lib/FML/Command/Admin/dir.pm new file mode 100644 index 00000000..6ee36ff7 --- /dev/null +++ b/fml/lib/FML/Command/Admin/dir.pm @@ -0,0 +1,116 @@ +#-*- perl -*- +# +# Copyright (C) 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: dir.pm,v 1.1 2002/03/19 11:13:45 fukachan Exp $ +# + +package FML::Command::Admin::dir; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +=head1 NAME + +FML::Command::Admin::dir - dir file operations + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +dir a new address. + +=head1 METHODS + +=head2 C<process($curproc, $command_args)> + +=cut + + +# Descriptions: standard constructor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: OBJ +sub new +{ + my ($self) = @_; + my ($type) = ref($self) || $self; + my $me = {}; + return bless $me, $type; +} + + +# Descriptions: need lock or not +# Arguments: none +# Side Effects: none +# Return Value: NUM( 1 or 0) +sub need_lock { 0;} + + +# Descriptions: dir a new user +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: update $member_map $recipient_map +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + my $config = $curproc->{ config }; + my $log_file = $config->{ log_file }; + my $options = $command_args->{ options }; + my $du_args = {}; + my @argv = (); + + # analyze ... + for my $x (@$options) { + if ($x =~ /^(\-[A-Za-z]+)$/) { + $du_args->{ opt_ls } = $1; + } + else { + push(@argv, $x); + } + } + $du_args->{ options } = \@argv; + + use FML::Command::DirUtils; + my $obj = new FML::Command::DirUtils; + $obj->dir($curproc, $command_args, $du_args); +} + + +# Descriptions: log a new user +# 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) = @_; + + ; +} + + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 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. + +=head1 HISTORY + +FML::Command::Admin::log 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/Admin/ls.pm b/fml/lib/FML/Command/Admin/ls.pm new file mode 100644 index 00000000..be8d78c2 --- /dev/null +++ b/fml/lib/FML/Command/Admin/ls.pm @@ -0,0 +1,61 @@ +#-*- perl -*- +# +# Copyright (C) 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: ls.pm,v 1.5 2002/02/18 14:24:11 fukachan Exp $ +# + +package FML::Command::Admin::ls; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::dir; +@ISA = qw(FML::Command::Admin::dir); + + +# Descriptions: dir +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to dir module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::ls - ls a new member + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +same as C<dir>. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 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. + +=head1 HISTORY + +FML::Command::Admin::ls 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/DirUtils.pm b/fml/lib/FML/Command/DirUtils.pm new file mode 100644 index 00000000..cc5e9362 --- /dev/null +++ b/fml/lib/FML/Command/DirUtils.pm @@ -0,0 +1,116 @@ +#-*- perl -*- +# +# Copyright (C) 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: DirUtils.pm,v 1.3 2002/12/23 03:50:26 fukachan Exp $ +# + +package FML::Command::DirUtils; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +=head1 NAME + +FML::Command::DirUtils - utilities for directory handling + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head1 METHODS + +=cut + + +# Descriptions: standard constructor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: OBJ +sub new +{ + my ($self) = @_; + my ($type) = ref($self) || $self; + my $me = {}; + + use FML::Restriction::CGI; + my $safe = new FML::Restriction::CGI; + my $safe_param_regexp = $safe->param_regexp(); + my $safe_method_regexp = $safe->method_regexp(); + + $me->{ _safe_param_regexp } = $safe_param_regexp; + $me->{ _safe_method_regexp } = $safe_method_regexp; + + return bless $me, $type; +} + + +# Descriptions: ls +# Arguments: OBJ($self) HASH_REF($curproc) HASH_REF($command_args) +# HASH_REF($du_args) +# Side Effects: none +# Return Value: none +sub dir +{ + my ($self, $curproc, $command_args, $du_args) = @_; + my $config = $curproc->{ config }; + my $path_ls = $config->{ path_ls }; + my $argv = $du_args->{ argv }; + my $opt_ls = ''; + + use Data::Dumper; + print STDERR Dumper( $du_args ); + sleep 3; + + # option + if (defined($du_args->{ opt_ls }) && + $du_args->{ opt_ls } =~ /^-[A-Za-z]+$/) { + $opt_ls = $du_args->{ opt_ls }; + } + + # regexp + my $safe_param_regexp = $self->{ _safe_param_regexp }; + my $regexp = $safe_param_regexp->{ directory }; + + my $ml_home_dir = $config->{ ml_home_dir }; + chdir $ml_home_dir; + + my $y = ''; + for my $x (@$argv) { + if ($x =~ /^$regexp$/ || $x =~ /^\s*$/) { + $y .= " ". $x; + } + } + + if (-x $path_ls) { + my $buf = `$path_ls $opt_ls $y`; + $curproc->reply_message($buf); + } + else { + croak("\$path_ls is not found"); + } +} + + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 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. + +=head1 HISTORY + +FML::Command::DirUtils appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; |
