summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-03-17 13:22:24 +0000
committerfukachan <fukachan>2003-03-17 13:22:24 +0000
commit43bf7a7350181a69bdaba1af7201427c75cb124a (patch)
treea82b29de0d6520415bb53fe4e48f7897ae477b5b /fml
parent28ddbda81c13e4711553f6d53b768c87da630c2b (diff)
downloadfml8-43bf7a7350181a69bdaba1af7201427c75cb124a.tar.gz
fml8-43bf7a7350181a69bdaba1af7201427c75cb124a.tar.bz2
fml8-43bf7a7350181a69bdaba1af7201427c75cb124a.zip
move the main code to FML::Command::UserControl.
modified to use FML::Command::UserControl.
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/FML/Command/Admin/chaddr.pm74
1 files changed, 19 insertions, 55 deletions
diff --git a/fml/lib/FML/Command/Admin/chaddr.pm b/fml/lib/FML/Command/Admin/chaddr.pm
index c96af21d..771989c5 100644
--- a/fml/lib/FML/Command/Admin/chaddr.pm
+++ b/fml/lib/FML/Command/Admin/chaddr.pm
@@ -4,13 +4,15 @@
# 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.12 2003/02/01 13:45:58 fukachan Exp $
+# $FML: chaddr.pm,v 1.13 2003/02/09 12:31:41 fukachan Exp $
#
package FML::Command::Admin::chaddr;
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
use Carp;
+use FML::Log qw(Log LogWarn LogError);
+
=head1 NAME
@@ -85,64 +87,26 @@ sub process
croak("\$member_maps is not specified") unless $member_maps;
croak("\$recipient_maps is not specified") unless $recipient_maps;
- use IO::Adapter;
- use FML::Credential;
- use FML::Log qw(Log LogWarn LogError);
-
# 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;
-
- # exatct match as could as possible.
- $cred->set_compare_level( 100 );
-
- # 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)) {
- my $old_address_in_map = $cred->matched_address();
-
- unless ($cred->has_address_in_map($map, $config, $new_address)) {
- # remove the old address only if $new_address not included.
- {
- my $obj = new IO::Adapter $map, $config;
- $obj->touch();
-
- $obj->open();
- $obj->delete( $old_address_in_map );
- unless ($obj->error()) {
- Log("delete $old_address from map=$map");
- }
- else {
- croak("fail to delete $old_address to map=$map");
- }
- $obj->close();
- }
-
- # restart map to add the new address.
- # XXX we need to restart or rewrind map.
- {
- my $obj = new IO::Adapter $map, $config;
- $obj->open();
- $obj->add( $new_address );
- unless ($obj->error()) {
- Log("add $new_address to map=$map");
- }
- else {
- croak("fail to add $new_address to map=$map");
- }
- $obj->close();
- }
- }
- else {
- croak("$new_address is already member (map=$map)");
- return undef;
- }
- }
+
+ # FML::Command::UserControl specific parameters
+ my $uc_args = {
+ old_address => $old_address,
+ new_address => $new_address,
+ maplist => \@maps,
+ };
+ my $r = '';
+
+ eval q{
+ use FML::Command::UserControl;
+ my $obj = new FML::Command::UserControl;
+ $obj->user_chaddr($curproc, $command_args, $uc_args);
+ };
+ if ($r = $@) {
+ croak($r);
}
}