diff options
| author | fukachan <fukachan> | 2002-03-19 10:12:44 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-03-19 10:12:44 +0000 |
| commit | 31c70b1e3cd0d7f800386fc61bbf6ac552fec24b (patch) | |
| tree | 8aa584c82973b9ab1b84c7085fbe2a8b0e1c5cd5 /fml/lib/FML/Command/Admin/subscribe.pm | |
| parent | 3329f6529d627b784c80d2268453a993e923c4c0 (diff) | |
| download | fml8-31c70b1e3cd0d7f800386fc61bbf6ac552fec24b.tar.gz fml8-31c70b1e3cd0d7f800386fc61bbf6ac552fec24b.tar.bz2 fml8-31c70b1e3cd0d7f800386fc61bbf6ac552fec24b.zip | |
define FML::Command::UserControl class to share user control codes.
modified Admin::{subscribe,unsubscribe} commands to use it.
Diffstat (limited to 'fml/lib/FML/Command/Admin/subscribe.pm')
| -rw-r--r-- | fml/lib/FML/Command/Admin/subscribe.pm | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/fml/lib/FML/Command/Admin/subscribe.pm b/fml/lib/FML/Command/Admin/subscribe.pm index b38da245..6075b98d 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.12 2002/03/17 05:27:31 fukachan Exp $ +# $FML: subscribe.pm,v 1.13 2002/03/19 08:00:18 fukachan Exp $ # package FML::Command::Admin::subscribe; @@ -66,31 +66,24 @@ sub process my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address is not specified") unless defined $address; + croak("address is not specified") unless defined $address; croak("\$member_map is not specified") unless $member_map; croak("\$recipient_map is not specified") unless $recipient_map; - use IO::Adapter; - use FML::Credential; - use FML::Log qw(Log LogWarn LogError); - - for my $map ($member_map, $recipient_map) { - my $cred = new FML::Credential; - unless ($cred->has_address_in_map($map, $address)) { - my $obj = new IO::Adapter $map; - $obj->touch(); - $obj->add( $address ); - unless ($obj->error()) { - Log("add $address to map=$map"); - } - else { - croak("fail to add $address to map=$map"); - } - } - else { - croak( "$address is already member (map=$map)" ); - return undef; - } + # FML::Command::UserControl specific parameters + my $uc_args = { + address => $address, + maplist => [ $recipient_map, $member_map ], + }; + my $r = ''; + + eval q{ + use FML::Command::UserControl; + my $obj = new FML::Command::UserControl; + $obj->useradd($curproc, $command_args, $uc_args); + }; + if ($r = $@) { + croak($r); } } |
