summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-09-13 11:53:29 +0000
committerfukachan <fukachan>2001-09-13 11:53:29 +0000
commitc3307a0e7d62812228bb45f6e24609c5f4e9c6c4 (patch)
treedd580cf8b666dfc9b3c1f8e93025a3826a0139ae /fml/lib/FML/Command
parent85b1f018ab875341f53e6f73b654ed69ff90cb0a (diff)
downloadfml8-c3307a0e7d62812228bb45f6e24609c5f4e9c6c4.tar.gz
fml8-c3307a0e7d62812228bb45f6e24609c5f4e9c6c4.tar.bz2
fml8-c3307a0e7d62812228bb45f6e24609c5f4e9c6c4.zip
new hier: makefml uses Command::Admin
Diffstat (limited to 'fml/lib/FML/Command')
-rw-r--r--fml/lib/FML/Command/Admin/bye.pm4
-rw-r--r--fml/lib/FML/Command/Admin/get.pm40
-rw-r--r--fml/lib/FML/Command/Admin/subscribe.pm16
-rw-r--r--fml/lib/FML/Command/Admin/unsubscribe.pm19
4 files changed, 57 insertions, 22 deletions
diff --git a/fml/lib/FML/Command/Admin/bye.pm b/fml/lib/FML/Command/Admin/bye.pm
index 09494de0..d4e7d7ce 100644
--- a/fml/lib/FML/Command/Admin/bye.pm
+++ b/fml/lib/FML/Command/Admin/bye.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: bye.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $
+# $FML: bye.pm,v 1.1.1.1 2001/08/26 08:01:04 fukachan Exp $
#
package FML::Command::Admin::bye;
@@ -12,7 +12,7 @@ use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
use Carp;
-FML::Command::Utils;
+use FML::Command::Utils;
use FML::Command::Admin::unsubscribe;
@ISA = qw(FML::Command::Admin::unsubscribe FML::Command::Utils);
diff --git a/fml/lib/FML/Command/Admin/get.pm b/fml/lib/FML/Command/Admin/get.pm
index 4a44ddbe..a20a9e1d 100644
--- a/fml/lib/FML/Command/Admin/get.pm
+++ b/fml/lib/FML/Command/Admin/get.pm
@@ -1,10 +1,10 @@
#-*- perl -*-
-f#
+#
# 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: get.pm,v 1.2 2001/08/26 07:59:03 fukachan Exp $
+# $FML: get.pm,v 1.1.1.1 2001/08/26 08:01:04 fukachan Exp $
#
package FML::Command::Admin::get;
@@ -28,17 +28,41 @@ not yet implemented
=head1 METHODS
-=head2 C<new()>
-
=cut
sub process
{
- my ($self) = @_;
- my ($type) = ref($self) || $self;
- my $me = {};
- return bless $me, $type;
+ my ($self, $curproc, $optargs) = @_;
+ my $options = $optargs->{ 'options' };
+ my $config = $curproc->{ 'config' };
+ my $spool_dir = $config->{ 'spool_dir' };
+ my @options = @$options;
+ my $recipient = shift @options;
+ my @files;
+
+ for my $id (@options) {
+ use File::Spec;
+ my $f = File::Spec->catfile($spool_dir, $id);
+ if (-f $f) {
+ $curproc->reply_message( {
+ type => "message/rfc822",
+ path => $f,
+ filename => $id,
+ disposition => "article $id",
+ });
+ }
+ else {
+ use FML::Log qw(Log);
+ &Log("article $id not found");
+ }
+ }
+
+ $curproc->queue_in('reply_message', {
+ 'sender' => 'fukachan',
+ 'subject' => 'get result',
+ 'recipient' => $recipient,
+ });
}
diff --git a/fml/lib/FML/Command/Admin/subscribe.pm b/fml/lib/FML/Command/Admin/subscribe.pm
index 837854a1..f555da32 100644
--- a/fml/lib/FML/Command/Admin/subscribe.pm
+++ b/fml/lib/FML/Command/Admin/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.1.1.1 2001/08/26 08:01:04 fukachan Exp $
+# $FML: subscribe.pm,v 1.2 2001/08/26 13:09:29 fukachan Exp $
#
package FML::Command::Admin::subscribe;
@@ -48,20 +48,24 @@ sub process
croak("\$recipient_map is not specified") unless $recipient_map;
use IO::Adapter;
- my $obj = new IO::Adapter $member_map;
- $obj->touch();
-
use FML::Credential;
+ use FML::Log qw(Log LogWarn LogError);
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;
+ my $obj = new IO::Adapter $map;
$obj->touch();
$obj->add( $address );
+ unless ($obj->error()) {
+ Log("added $address to map=$map");
+ }
+ else {
+ LogError("fail to add $address to map=$map");
+ }
}
else {
- $self->error_set( "$address is member (map=$map)" );
+ $self->error_set( "$address is already member (map=$map)" );
return undef;
}
}
diff --git a/fml/lib/FML/Command/Admin/unsubscribe.pm b/fml/lib/FML/Command/Admin/unsubscribe.pm
index 3eef88ac..85c10c72 100644
--- a/fml/lib/FML/Command/Admin/unsubscribe.pm
+++ b/fml/lib/FML/Command/Admin/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.2 2001/08/26 07:59:03 fukachan Exp $
+# $FML: unsubscribe.pm,v 1.1.1.1 2001/08/26 08:01:04 fukachan Exp $
#
package FML::Command::Admin::unsubscribe;
@@ -47,11 +47,18 @@ sub process
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::Log qw(Log LogWarn LogError);
+
+ for my $map ($member_map, $recipient_map) {
+ my $obj = new IO::Adapter $map;
+ $obj->delete( $address );
+ unless ($obj->error()) {
+ Log("removed $address from map=$map");
+ }
+ else {
+ LogError("fail to remove $address from map=$map");
+ }
+ }
}