summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-03-11 13:35:33 +0000
committerfukachan <fukachan>2001-03-11 13:35:33 +0000
commitac800de70f2a442304535e4ac643224b633fff8f (patch)
treee73b69b10d74292272ba5ebd93493f5ccc90db37
parentaef0ed47099eeeb2eae7b214ce28b84453685672 (diff)
downloadfml8-ac800de70f2a442304535e4ac643224b633fff8f.tar.gz
fml8-ac800de70f2a442304535e4ac643224b633fff8f.tar.bz2
fml8-ac800de70f2a442304535e4ac643224b633fff8f.zip
make makefml work
-rw-r--r--fml/lib/FML/MemberControl.pm103
-rw-r--r--fml/lib/FML/Process/Configure.pm24
-rw-r--r--fml/lib/FML/Process/Switch.pm6
3 files changed, 133 insertions, 0 deletions
diff --git a/fml/lib/FML/MemberControl.pm b/fml/lib/FML/MemberControl.pm
new file mode 100644
index 00000000..74b83609
--- /dev/null
+++ b/fml/lib/FML/MemberControl.pm
@@ -0,0 +1,103 @@
+#-*- 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.
+#
+# $Id$
+# $FML$
+#
+
+package FML::MemberControl;
+use strict;
+use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
+use Carp;
+
+=head1 NAME
+
+FML::MemberControl - controller
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=head2 C<new()>
+
+=cut
+
+sub new
+{
+ my ($self) = @_;
+ my ($type) = ref($self) || $self;
+ my $me = {};
+ return bless $me, $type;
+}
+
+
+=head2 C<add( $address )>
+
+=cut
+
+
+sub add
+{
+ my ($self, $curproc, $address) = @_;
+ my $config = $curproc->{ config };
+ my $member_map = $config->{ primary_member_map };
+ my $recipient_map = $config->{ primary_recipient_map };
+
+ # fundamental check
+ croak("\$member_map is not specified") unless $member_map;
+ croak("\$recipient_map is not specified") unless $recipient_map;
+
+ use IO::MapAdapter;
+ my $obj = new IO::MapAdapter $member_map;
+ $obj->add( $address );
+
+ $obj = new IO::MapAdapter $recipient_map;
+ $obj->add( $address );
+}
+
+
+sub delete
+{
+ my ($self, $curproc, $address) = @_;
+ my $config = $curproc->{ config };
+ my $member_map = $config->{ primary_member_map };
+ my $recipient_map = $config->{ primary_recipient_map };
+
+ # fundamental check
+ croak("\$member_map is not specified") unless $member_map;
+ croak("\$recipient_map is not specified") unless $recipient_map;
+
+ use IO::MapAdapter;
+ my $obj = new IO::MapAdapter $member_map;
+ $obj->delete( $address );
+
+ $obj = new IO::MapAdapter $recipient_map;
+ $obj->delete( $address );
+}
+
+
+=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::MemberControl appeared in fml5 mailing list driver package.
+See C<http://www.fml.org/> for more details.
+
+=cut
+
+
+1;
diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm
index 22c33ba6..f018fd88 100644
--- a/fml/lib/FML/Process/Configure.pm
+++ b/fml/lib/FML/Process/Configure.pm
@@ -67,6 +67,24 @@ sub run
elsif ($myname eq 'fmldoc') {
exec 'perldoc', @$argv;
}
+ elsif ($myname eq 'makefml') {
+ require FML::MemberControl;
+ my $obj = new FML::MemberControl;
+ my ($command, $ml_name, @options) = @$argv;
+ if ($command eq 'add' || $command eq 'subscribe') {
+ $curproc->lock();
+ $obj->add($curproc, @options);
+ $curproc->unlock();
+ }
+ elsif ($command eq 'bye' || $command eq 'unsubscribe') {
+ $curproc->lock();
+ $obj->delete($curproc, @options);
+ $curproc->unlock();
+ }
+ else {
+ croak("unknown");
+ }
+ }
else {
my $command = $argv->[ 0 ] || croak("command not specified\n");
$curproc->lock();
@@ -93,6 +111,12 @@ sub _show_conf
}
+# dummy to avoid the error ( undefined function )
+sub AUTOLOAD
+{
+ ;
+}
+
=head1 AUTHOR
Ken'ichi Fukamachi
diff --git a/fml/lib/FML/Process/Switch.pm b/fml/lib/FML/Process/Switch.pm
index 87b9708c..5619835f 100644
--- a/fml/lib/FML/Process/Switch.pm
+++ b/fml/lib/FML/Process/Switch.pm
@@ -264,6 +264,9 @@ sub _module_specific_options
elsif ($myname eq 'fmldoc') {
return qw(ctladdr! debug! params=s -c=s n!);
}
+ elsif ($myname eq 'makefml') {
+ return qw(ctladdr! debug! params=s -c=s n!);
+ }
else {
croak "options for $myname are not defined.\n";
}
@@ -281,6 +284,9 @@ sub _ml_name_is_required
if ($myname eq 'fmldoc') {
return 0;
}
+ elsif ($myname eq 'makefml') {
+ return 0;
+ }
elsif ($myname eq 'fmlticket.cgi') {
return 0;
}