diff options
| author | fukachan <fukachan> | 2001-08-26 05:43:10 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-08-26 05:43:10 +0000 |
| commit | a2fe7900f364da2b2d6aa71f5286f8202384cf7b (patch) | |
| tree | 8ae37dd54efd797ef500185134bd80374019e051 /fml/lib | |
| parent | 7d86a254321871b9d088622aba0d4e0634cfe8e7 (diff) | |
| download | fml8-a2fe7900f364da2b2d6aa71f5286f8202384cf7b.tar.gz fml8-a2fe7900f364da2b2d6aa71f5286f8202384cf7b.tar.bz2 fml8-a2fe7900f364da2b2d6aa71f5286f8202384cf7b.zip | |
move FML::Command to FML::Command::User
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Command/User/add.pm | 54 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/bye.pm | 55 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/edit.pm | 93 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/get.pm | 64 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/mget.pm | 59 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/newml.pm | 92 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/remove.pm | 55 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/resign.pm | 56 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/signoff.pm | 53 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/subscribe.pm | 91 | ||||
| -rw-r--r-- | fml/lib/FML/Command/User/unsubscribe.pm | 77 |
11 files changed, 749 insertions, 0 deletions
diff --git a/fml/lib/FML/Command/User/add.pm b/fml/lib/FML/Command/User/add.pm new file mode 100644 index 00000000..05c2362c --- /dev/null +++ b/fml/lib/FML/Command/User/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.7 2001/07/15 12:03:37 fukachan Exp $ +# + +package FML::Command::User::add; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::User::subscribe; +@ISA = qw(FML::Command::User::subscribe FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::process($curproc, $optargs); +} + +=head1 NAME + +FML::Command::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::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/User/bye.pm b/fml/lib/FML/Command/User/bye.pm new file mode 100644 index 00000000..e623ecd0 --- /dev/null +++ b/fml/lib/FML/Command/User/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.8 2001/07/15 12:03:37 fukachan Exp $ +# + +package FML::Command::User::bye; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +FML::Command::Utils; +use FML::Command::unsubscribe; +@ISA = qw(FML::Command::unsubscribe FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::process($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::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::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/User/edit.pm b/fml/lib/FML/Command/User/edit.pm new file mode 100644 index 00000000..77c5626b --- /dev/null +++ b/fml/lib/FML/Command/User/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.6 2001/08/05 22:36:43 fukachan Exp $ +# + +package FML::Command::User::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::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::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/User/get.pm b/fml/lib/FML/Command/User/get.pm new file mode 100644 index 00000000..8ab89448 --- /dev/null +++ b/fml/lib/FML/Command/User/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.5 2001/08/26 04:13:40 fukachan Exp $ +# + +package FML::Command::User::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::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::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/User/mget.pm b/fml/lib/FML/Command/User/mget.pm new file mode 100644 index 00000000..1d256afe --- /dev/null +++ b/fml/lib/FML/Command/User/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.5 2001/08/26 04:13:40 fukachan Exp $ +# + +package FML::Command::User::mget; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use ErrorStatus; +use FML::Command::Utils; +use FML::Command::User::get; +@ISA = qw(FML::Command::User::get); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::process($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::mget - what is this + +=head1 SYNOPSIS + +forwarded C<FML::Command::User::get>. + +=head1 DESCRIPTION + +forwarded C<FML::Command::User::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::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/User/newml.pm b/fml/lib/FML/Command/User/newml.pm new file mode 100644 index 00000000..1e1722f3 --- /dev/null +++ b/fml/lib/FML/Command/User/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.8 2001/08/22 03:07:59 fukachan Exp $ +# + +package FML::Command::User::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::newml - make a new mailing list + +=head1 SYNOPSIS + + use FML::Command::newml; + $obj = new FML::Command::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::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/User/remove.pm b/fml/lib/FML/Command/User/remove.pm new file mode 100644 index 00000000..854501aa --- /dev/null +++ b/fml/lib/FML/Command/User/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.7 2001/07/15 12:03:37 fukachan Exp $ +# + +package FML::Command::User::remove; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::unsubscribe; +@ISA = qw(FML::Command::unsubscribe use FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::unsubscribe($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::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::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/User/resign.pm b/fml/lib/FML/Command/User/resign.pm new file mode 100644 index 00000000..d4feff9c --- /dev/null +++ b/fml/lib/FML/Command/User/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.8 2001/08/26 04:13:40 fukachan Exp $ +# + +package FML::Command::User::resign; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::unsubscribe; +@ISA = qw(FML::Command::unsubscribe use FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->unsubscribe($curproc, $optargs); +} + +=head1 NAME + +FML::Command::resign - alias of "unsubscribe" command + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +all requests are forwarded to C<FML::Command::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::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/User/signoff.pm b/fml/lib/FML/Command/User/signoff.pm new file mode 100644 index 00000000..e508e16f --- /dev/null +++ b/fml/lib/FML/Command/User/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.3 2001/07/15 12:03:37 fukachan Exp $ +# + +package FML::Command::User::signoff; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + +use FML::Command::Utils; +use FML::Command::unsubscribe; +@ISA = qw(FML::Command::unsubscribe use FML::Command::Utils); + +sub process +{ + my ($self, $curproc, $optargs) = @_; + $self->SUPER::unsubscribe($curproc, $optargs); +} + + +=head1 NAME + +FML::Command::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::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/User/subscribe.pm b/fml/lib/FML/Command/User/subscribe.pm new file mode 100644 index 00000000..41e1f64a --- /dev/null +++ b/fml/lib/FML/Command/User/subscribe.pm @@ -0,0 +1,91 @@ +#-*- 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.10 2001/07/15 12:03:37 fukachan Exp $ +# + +package FML::Command::User::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::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(); + $obj->add( $address ); + + if ($obj->error()) { + $self->error_set( $obj->error() ); + return undef; + } + + $obj = new IO::Adapter $recipient_map; + $obj->touch(); + $obj->add( $address ); + $self->error_set( $obj->error() ); + + if ($obj->error()) { + $self->error_set( $obj->error() ); + 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::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/User/unsubscribe.pm b/fml/lib/FML/Command/User/unsubscribe.pm new file mode 100644 index 00000000..9b9760c7 --- /dev/null +++ b/fml/lib/FML/Command/User/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.10 2001/07/15 12:03:37 fukachan Exp $ +# + +package FML::Command::User::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::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::unsubscribe appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; |
