diff options
-rw-r--r-- | Echolot/Commands.pm | 8 | ||||
-rwxr-xr-x | pingd | 71 |
2 files changed, 69 insertions, 10 deletions
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm index 6cc0612..86ea89c 100644 --- a/Echolot/Commands.pm +++ b/Echolot/Commands.pm @@ -1,7 +1,7 @@ package Echolot::Commands; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Commands.pm,v 1.2 2002/07/02 14:06:51 weasel Exp $ +# $Id: Commands.pm,v 1.3 2002/07/02 17:03:13 weasel Exp $ # =pod @@ -61,10 +61,12 @@ sub processCommands($) { while (<FH>) { chomp; - my ($command, $args) = split; + my ($command, @args) = split; if ($command eq 'add') { - Echolot::Globals::get()->{'storage'}->add_address($args); + Echolot::Globals::get()->{'storage'}->add_address(@args); + } elsif ($command eq 'set') { + Echolot::Globals::get()->{'storage'}->set_stuff(@args); } else { warn("Unkown command: $_\n"); }; @@ -1,7 +1,7 @@ #!/usr/bin/perl -wT # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: pingd,v 1.8 2002/07/02 14:11:49 weasel Exp $ +# $Id: pingd,v 1.9 2002/07/02 17:03:12 weasel Exp $ # =pod @@ -18,7 +18,9 @@ pingd - echolot ping daemon =item B<pingd> B<stop> -=item B<pingd> B<add> I<address> +=item B<pingd> B<add> I<address> [I<address> ...] + +=item B<pingd> B<set> option=value [option=value..] I<address> [I<address> ...] =back @@ -50,11 +52,34 @@ Start the ping daemon. Send the running pingd process a SIGTERM. -=item B<add> I<address> +=item B<add> I<address> [I<address> ...] Add I<address> to the list of remailers to query for keys and confs. +=item B<set> option=value [option=value..] I<address> [I<address> ...] + +Possible options and values: + +=over + +=item B<showit=>{B<on>,B<off>} + +Set B<showit> (show remailer in mlist, rlist etc.) for remailer I<address> to +either B<on> or B<off>. + +=item B<pingit=>{B<on>,B<off>} + +Set B<pingit> (send out pings to that remailer) for remailer I<address> to +either B<on> or B<off>. + +=item B<fetch=>{B<on>,B<off>} + +Set B<fetch> (fetch remailer-key and remailer-conf) for remailer I<address> to +either B<on> or B<off>. + +=back + =head1 OPTIONS none @@ -161,10 +186,34 @@ Echolot::Globals::init(); if ($COMMAND eq 'add') { - my $address = shift @ARGV; - die ("add requires argument <address>\n") unless defined $address; - die ("argument <address> is not a valid email address\n") unless ($address =~ /^[a-zA-Z0-9+.-]+\@[a-zA-Z0-9+.-]+$/ ); - Echolot::Commands::addCommand("add $address"); + die ("add requires argument <address>\n") unless scalar @ARGV; + my @addresses; + for my $address (@ARGV) { + die ("argument <address> is not a valid email address\n") unless ($address =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ ); + push @addresses, $address; + }; + for my $address (@addresses) { + Echolot::Commands::addCommand("add $address"); + }; + # FIXME send hup +} elsif ($COMMAND eq 'set') { + my @settings; + while (scalar @ARGV && $ARGV[0] =~ /^(showit|pingit|fetch)=(on|off)$/) { + push @settings, $ARGV[0]; + shift @ARGV; + }; + + my @addresses; + for my $address (@ARGV) { + die ("argument $address is not a valid email address\n") unless ($address =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ ); + push @addresses, $address; + }; + + for my $address (@ARGV) { + for my $setting (@settings) { + Echolot::Commands::addCommand("set $address $setting"); + }; + }; # FIXME send hup } elsif ($COMMAND eq 'stop') { die ("stop not implemented yet"); @@ -188,6 +237,14 @@ if ($COMMAND eq 'add') { Echolot::Globals::get()->{'storage'}->commit(); Echolot::Globals::get()->{'storage'}->finish(); +} elsif ($COMMAND eq 'convert') { + Echolot::Globals::initStorage(); + setSigHandlers(); + + Echolot::Globals::get()->{'storage'}->convert(); + + Echolot::Globals::get()->{'storage'}->commit(); + Echolot::Globals::get()->{'storage'}->finish(); } else { die ("Command $COMMAND unknown"); }; |