diff options
| author | fukachan <fukachan> | 2001-10-13 02:42:30 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-10-13 02:42:30 +0000 |
| commit | 4103d5f8ce820d4999359723660d1fb86d385dc2 (patch) | |
| tree | f351c5aac696f0befa37a172e0a4acf80cb464c3 /fml/lib/FML/Command | |
| parent | b3e8182f4bd2dc48905876388d993f8bd1109636 (diff) | |
| download | fml8-4103d5f8ce820d4999359723660d1fb86d385dc2.tar.gz fml8-4103d5f8ce820d4999359723660d1fb86d385dc2.tar.bz2 fml8-4103d5f8ce820d4999359723660d1fb86d385dc2.zip | |
confirm version
Diffstat (limited to 'fml/lib/FML/Command')
| -rw-r--r-- | fml/lib/FML/Command/User/unsubscribe.pm | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/fml/lib/FML/Command/User/unsubscribe.pm b/fml/lib/FML/Command/User/unsubscribe.pm index 8f6dd553..8d639064 100644 --- a/fml/lib/FML/Command/User/unsubscribe.pm +++ b/fml/lib/FML/Command/User/unsubscribe.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: unsubscribe.pm,v 1.1.1.1 2001/08/26 05:43:10 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.4 2001/10/11 23:59:03 fukachan Exp $ # package FML::Command::User::unsubscribe; @@ -14,18 +14,20 @@ use Carp; use ErrorStatus; use FML::Command::Utils; +use FML::Log qw(Log LogWarn LogError); @ISA = qw(FML::Command::Utils ErrorStatus); + =head1 NAME -FML::Command::User::unsubscribe - remove the specified member +FML::Command::User::unsubscribe - unsubscribe member =head1 SYNOPSIS -See C<FML::Command> for more details. - =head1 DESCRIPTION +See C<FML::Command> for more details. + =head1 METHODS =head2 C<process($curproc, $optargs)> @@ -39,19 +41,38 @@ sub process 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 ]; + my $cache_dir = $config->{ db_dir }; + my $keyword = $config->{ confirm_keyword }; + my $command = $optargs->{ command }; + my $address = $curproc->{ credential }->sender(); # 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 ); + use FML::Credential; + my $cred = new FML::Credential; + + # if not member, unsubscriber request is wrong. + unless ($cred->is_member($curproc, { address => $address })) { + $curproc->reply_message_nl('error.not_member'); + croak("not member"); + } + # try confirmation before unsubscribe + else { + Log("unsubscriber request, try confirmation"); + use FML::Confirm; + my $confirm = new FML::Confirm { + keyword => $keyword, + cache_dir => $cache_dir, + class => 'unsubscribe', + address => $address, + buffer => $command, + }; + my $id = $confirm->assign_id; + $curproc->reply_message_nl('command.confirm'); + $curproc->reply_message("\n$id\n"); + } } |
