diff options
| author | fukachan <fukachan> | 2001-08-26 07:58:39 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-08-26 07:58:39 +0000 |
| commit | 05301a85e7b79f0b16bfec61c54f00bde3a1dcba (patch) | |
| tree | ef27df4631fee61da920b19da89d51f4ab7652b1 | |
| parent | 9f6d8850a1bac24b663bacae7a4df87ea8da936d (diff) | |
| download | fml8-05301a85e7b79f0b16bfec61c54f00bde3a1dcba.tar.gz fml8-05301a85e7b79f0b16bfec61c54f00bde3a1dcba.tar.bz2 fml8-05301a85e7b79f0b16bfec61c54f00bde3a1dcba.zip | |
check the address is alrady subscribed or not by FML::Credential module.
s/Command/Command::User/
| -rw-r--r-- | fml/lib/FML/Command/User/subscribe.pm | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/fml/lib/FML/Command/User/subscribe.pm b/fml/lib/FML/Command/User/subscribe.pm index 41e1f64a..f9572ac3 100644 --- a/fml/lib/FML/Command/User/subscribe.pm +++ b/fml/lib/FML/Command/User/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.10 2001/07/15 12:03:37 fukachan Exp $ +# $FML: subscribe.pm,v 1.1.1.1 2001/08/26 05:43:10 fukachan Exp $ # package FML::Command::User::subscribe; @@ -19,7 +19,7 @@ use FML::Command::Utils; =head1 NAME -FML::Command::subscribe - subscribe a new member +FML::Command::User::subscribe - subscribe a new member =head1 SYNOPSIS @@ -50,21 +50,20 @@ sub process 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; + 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; + } } } @@ -82,7 +81,7 @@ 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. +FML::Command::User::subscribe appeared in fml5 mailing list driver package. See C<http://www.fml.org/> for more details. =cut |
