diff options
| author | fukachan <fukachan> | 2001-08-26 08:01:04 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-08-26 08:01:04 +0000 |
| commit | 2778bbc87f6ec3daea013676636c573cad671aa3 (patch) | |
| tree | d88711b6be3bfcefd29091d7e870e4f01dd691a6 | |
| parent | a2fe7900f364da2b2d6aa71f5286f8202384cf7b (diff) | |
| download | fml8-snap-20010826.tar.gz fml8-snap-20010826.tar.bz2 fml8-snap-20010826.zip | |
admin mode command prototypesnap-20010826
| -rw-r--r-- | fml/lib/FML/Command/Admin/add.pm | 54 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/bye.pm | 55 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/edit.pm | 93 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/get.pm | 64 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/mget.pm | 59 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/newml.pm | 92 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/remove.pm | 55 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/resign.pm | 56 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/signoff.pm | 53 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/subscribe.pm | 90 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/unsubscribe.pm | 77 |
11 files changed, 748 insertions, 0 deletions
diff --git a/fml/lib/FML/Command/Admin/add.pm b/fml/lib/FML/Command/Admin/add.pm new file mode 100644 index 00000000..37ed8175 --- /dev/null +++ b/fml/lib/FML/Command/Admin/add.pm @@ -0,0 +1,54 @@ +#-*- perl -*- +# +# 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. +# +# $FML: add.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::add; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::Admin::subscribe; +@ISA = qw(FML::Command::Admin::subscribe FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::process($curproc, $optargs); +} + +=head1 NAME + +FML::Command::Admin::add - add a new member + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +=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::Admin::add 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/bye.pm b/fml/lib/FML/Command/Admin/bye.pm new file mode 100644 index 00000000..09494de0 --- /dev/null +++ b/fml/lib/FML/Command/Admin/bye.pm @@ -0,0 +1,55 @@ +#-*- perl -*- +# +# 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. +# +# $FML: bye.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::bye; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +FML::Command::Utils; +use FML::Command::Admin::unsubscribe; +@ISA = qw(FML::Command::Admin::unsubscribe FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::process($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::Admin::bye - remove the specified member + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +=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::Admin::bye 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/edit.pm b/fml/lib/FML/Command/Admin/edit.pm new file mode 100644 index 00000000..cb49663a --- /dev/null +++ b/fml/lib/FML/Command/Admin/edit.pm @@ -0,0 +1,93 @@ +#-*- perl -*- +# +# 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. +# +# $FML: edit.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::edit; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; +use ErrorStatus; +use FML::Command::Utils; +@ISA = qw(FML::Command::Utils ErrorStatus); + +=head1 NAME + +FML::Command::Admin::edit - edit a new member + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +See C<FML::Command> for more details. + +=head1 METHODS + +=head1 METHODS + +=head2 C<process($curproc, $optargs)> + +C<TODO>: +now we can read and write config.cf, not change it. + +=cut + + +# Descriptions: edit config.cf +# Arguments: $self $curproc $optargs +# Side Effects: update config.cf +# Return Value: none +sub process +{ + my ($self, $curproc, $optargs) = @_; + my $config = $curproc->{ config }; + my $options = $optargs->{ options }; + my $address = $optargs->{ address } || $options->[ 0 ]; + my $myname = $optargs->{ args }->{ myname }; + + # ML's home directory + my $ml_home_dir = $optargs->{ 'args' }->{ 'ml_home_dir' }; + my $config_cf = $ml_home_dir."/config.cf"; + + use FML::Config; + my $c = new FML::Config; + + # read configuration. configuration is holded in FML:Config space. + $c->read( $config_cf ); + + # modify $c (config) object + # XXX TODO + # XXX ... snip ... + # $c->set('key', 'value'); # set up + # $c->regist('key'); # add list to write into config.cf + + # ovewrite $config_cf + # after old $config_cf is backup'ed to $config_cf.bak + $c->write( $config_cf ); +} + + +=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::Admin::edit 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/get.pm b/fml/lib/FML/Command/Admin/get.pm new file mode 100644 index 00000000..4a44ddbe --- /dev/null +++ b/fml/lib/FML/Command/Admin/get.pm @@ -0,0 +1,64 @@ +#-*- perl -*- +f# +# 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. +# +# $FML: get.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::get; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +@ISA = qw(FML::Command::Utils ErrorStatus); + +=head1 NAME + +FML::Command::Admin::get - what is this + +=head1 SYNOPSIS + +not yet implemented + +=head1 DESCRIPTION + +=head1 METHODS + +=head2 C<new()> + +=cut + + +sub process +{ + my ($self) = @_; + my ($type) = ref($self) || $self; + my $me = {}; + return bless $me, $type; +} + + +=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::Admin::get 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/mget.pm b/fml/lib/FML/Command/Admin/mget.pm new file mode 100644 index 00000000..c1f0b32c --- /dev/null +++ b/fml/lib/FML/Command/Admin/mget.pm @@ -0,0 +1,59 @@ + +#-*- perl -*- +# +# 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. +# +# $FML: mget.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::mget; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +use FML::Command::Admin::get; +@ISA = qw(FML::Command::Admin::get); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::process($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::Admin::mget - what is this + +=head1 SYNOPSIS + +forwarded C<FML::Command::Admin::get>. + +=head1 DESCRIPTION + +forwarded C<FML::Command::Admin::get>. + +=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::Admin::mget 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/newml.pm b/fml/lib/FML/Command/Admin/newml.pm new file mode 100644 index 00000000..48c8ce9d --- /dev/null +++ b/fml/lib/FML/Command/Admin/newml.pm @@ -0,0 +1,92 @@ +#-*- perl -*- +# +# 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. +# +# $FML: newml.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::newml; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +@ISA = qw(FML::Command::Utils ErrorStatus); + + +=head1 NAME + +FML::Command::Admin::newml - make a new mailing list + +=head1 SYNOPSIS + + use FML::Command::Admin::newml; + $obj = new FML::Command::Admin::newml; + $obj->newml($curproc, $optargs); + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +=head1 METHODS + +=head2 C<newml($curproc, $optargs)> + +=cut + + +sub process +{ + my ($self, $curproc, $optargs) = @_; + my $config = $curproc->{ config }; + my $main_cf = $curproc->{ main_cf }; + my $member_map = $config->{ primary_member_map }; + my $recipient_map = $config->{ primary_recipient_map }; + my $ml_name = $optargs->{ ml_name }; + + # fundamental check + croak("\$ml_name is not specified") unless $ml_name; + + my $ml_home_prefix = $main_cf->{ ml_home_prefix }; + my $ml_home_dir = "$ml_home_prefix/$ml_name"; + + use File::Utils qw(mkdirhier copy); + unless (-d $ml_home_dir) { + mkdirhier( $ml_home_dir, $config->{ default_dir_mode } || 0755 ); + + use File::Spec; + + my $default_config_dir = $main_cf->{ default_config_dir }; + my $src = File::Spec->catfile($default_config_dir, "config.cf"); + my $dst = File::Spec->catfile($ml_home_dir, 'config.cf'); + copy($src, $dst); + } + else { + warn("$ml_name already exists"); + } +} + + +=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::Admin::newml 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/remove.pm b/fml/lib/FML/Command/Admin/remove.pm new file mode 100644 index 00000000..28221bb5 --- /dev/null +++ b/fml/lib/FML/Command/Admin/remove.pm @@ -0,0 +1,55 @@ +#-*- perl -*- +# +# 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. +# +# $FML: remove.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::remove; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::Admin::unsubscribe; +@ISA = qw(FML::Command::Admin::unsubscribe use FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::unsubscribe($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::Admin::remove - remove the specified member + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +=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::Admin::remove 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/resign.pm b/fml/lib/FML/Command/Admin/resign.pm new file mode 100644 index 00000000..deb22088 --- /dev/null +++ b/fml/lib/FML/Command/Admin/resign.pm @@ -0,0 +1,56 @@ +#-*- perl -*- +# +# 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. +# +# $FML: resign.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::resign; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::Admin::unsubscribe; +@ISA = qw(FML::Command::Admin::unsubscribe use FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->unsubscribe($curproc, $optargs); +} + +=head1 NAME + +FML::Command::Admin::resign - alias of "unsubscribe" command + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +all requests are forwarded to C<FML::Command::Admin::unsubscribe>. + +=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::Admin::resign 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/signoff.pm b/fml/lib/FML/Command/Admin/signoff.pm new file mode 100644 index 00000000..0e2429c6 --- /dev/null +++ b/fml/lib/FML/Command/Admin/signoff.pm @@ -0,0 +1,53 @@ +#-*- perl -*- +# +# 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. +# +# $FML: signoff.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::signoff; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::Admin::unsubscribe; +@ISA = qw(FML::Command::Admin::unsubscribe use FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::unsubscribe($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::Admin::signoff - signoff the specified member + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=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::Admin::signoff 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/subscribe.pm b/fml/lib/FML/Command/Admin/subscribe.pm new file mode 100644 index 00000000..b4202da9 --- /dev/null +++ b/fml/lib/FML/Command/Admin/subscribe.pm @@ -0,0 +1,90 @@ +#-*- perl -*- +# +# 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. +# +# $FML: subscribe.pm,v 1.2 2001/08/26 07:58:39 fukachan Exp $ +# + +package FML::Command::Admin::subscribe; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +@ISA = qw(FML::Command::Utils ErrorStatus); + + +=head1 NAME + +FML::Command::Admin::subscribe - subscribe a new member + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +See C<FML::Command> for more details. + +=head1 METHODS + +=head2 C<process($curproc, $optargs)> + +=cut + + +sub process +{ + my ($self, $curproc, $optargs) = @_; + my $config = $curproc->{ config }; + my $member_map = $config->{ primary_member_map }; + my $recipient_map = $config->{ primary_recipient_map }; + my $options = $optargs->{ options }; + my $address = $optargs->{ address } || $options->[ 0 ]; + + # fundamental check + croak("\$member_map is not specified") unless $member_map; + croak("\$recipient_map is not specified") unless $recipient_map; + + use IO::Adapter; + my $obj = new IO::Adapter $member_map; + $obj->touch(); + + use FML::Credential; + + for my $map ($member_map, $recipient_map) { + my $cred = new FML::Credential; + unless ($cred->has_address_in_map($map, $address)) { + $obj = new IO::Adapter $map; + $obj->touch(); + $obj->add( $address ); + } + else { + $self->error_set( "$address already exists" ); + return undef; + } + } +} + + +=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::Admin::subscribe 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/unsubscribe.pm b/fml/lib/FML/Command/Admin/unsubscribe.pm new file mode 100644 index 00000000..3eef88ac --- /dev/null +++ b/fml/lib/FML/Command/Admin/unsubscribe.pm @@ -0,0 +1,77 @@ +#-*- perl -*- +# +# 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. +# +# $FML: unsubscribe.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $ +# + +package FML::Command::Admin::unsubscribe; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +@ISA = qw(FML::Command::Utils ErrorStatus); + +=head1 NAME + +FML::Command::Admin::unsubscribe - remove the specified member + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +=head1 METHODS + +=head2 C<process($curproc, $optargs)> + +=cut + + +sub process +{ + my ($self, $curproc, $optargs) = @_; + my $config = $curproc->{ config }; + my $member_map = $config->{ primary_member_map }; + my $recipient_map = $config->{ primary_recipient_map }; + my $options = $optargs->{ options }; + my $address = $optargs->{ address } || $options->[ 0 ]; + + # fundamental check + croak("\$member_map is not specified") unless $member_map; + croak("\$recipient_map is not specified") unless $recipient_map; + + use IO::Adapter; + my $obj = new IO::Adapter $member_map; + $obj->delete( $address ); + + $obj = new IO::Adapter $recipient_map; + $obj->delete( $address ); +} + + +=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::Admin::unsubscribe appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; |
