summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-10-13 02:43:02 +0000
committerfukachan <fukachan>2001-10-13 02:43:02 +0000
commit6658d81eb0ebf3f349baf4075ef4613dda261b9d (patch)
treeb5a4cc3f30dd27bc740e198a41c07912bdc22eec /fml/lib
parent4103d5f8ce820d4999359723660d1fb86d385dc2 (diff)
downloadfml8-6658d81eb0ebf3f349baf4075ef4613dda261b9d.tar.gz
fml8-6658d81eb0ebf3f349baf4075ef4613dda261b9d.tar.bz2
fml8-6658d81eb0ebf3f349baf4075ef4613dda261b9d.zip
confirm wrapper version
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Command/User/chaddr.pm98
1 files changed, 98 insertions, 0 deletions
diff --git a/fml/lib/FML/Command/User/chaddr.pm b/fml/lib/FML/Command/User/chaddr.pm
new file mode 100644
index 00000000..945e8791
--- /dev/null
+++ b/fml/lib/FML/Command/User/chaddr.pm
@@ -0,0 +1,98 @@
+#-*- 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: chaddr.pm,v 1.4 2001/10/11 23:59:03 fukachan Exp $
+#
+
+package FML::Command::User::chaddr;
+use strict;
+use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
+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::chaddr - chaddr 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 $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 FML::Credential;
+ my $cred = new FML::Credential;
+
+ # if not member, chaddrr request is wrong.
+ unless ($cred->is_member($curproc, { address => $address })) {
+ $curproc->reply_message_nl('error.not_member');
+ croak("not member");
+ }
+ # try confirmation before chaddr
+ else {
+ Log("chaddrr request, try confirmation");
+ use FML::Confirm;
+ my $confirm = new FML::Confirm {
+ keyword => $keyword,
+ cache_dir => $cache_dir,
+ class => 'chaddr',
+ address => $address,
+ buffer => $command,
+ };
+ my $id = $confirm->assign_id;
+ $curproc->reply_message_nl('command.confirm');
+ $curproc->reply_message("\n$id\n");
+ }
+}
+
+
+=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::User::chaddr appeared in fml5 mailing list driver package.
+See C<http://www.fml.org/> for more details.
+
+=cut
+
+
+1;