From ffe9e3f845b9151b2f3e8f6887332a79f107fa1c Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 2 Jul 2002 17:03:13 +0000 Subject: Added set command --- Echolot/Commands.pm | 8 +++--- 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 -# $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 () { 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"); }; diff --git a/pingd b/pingd index 658e049..aa70998 100755 --- a/pingd +++ b/pingd @@ -1,7 +1,7 @@ #!/usr/bin/perl -wT # (c) 2002 Peter Palfrader -# $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 B -=item B B I
+=item B B I
[I
...] + +=item B B option=value [option=value..] I
[I
...] =back @@ -50,11 +52,34 @@ Start the ping daemon. Send the running pingd process a SIGTERM. -=item B I
+=item B I
[I
...] Add I
to the list of remailers to query for keys and confs. +=item B option=value [option=value..] I
[I
...] + +Possible options and values: + +=over + +=item B{B,B} + +Set B (show remailer in mlist, rlist etc.) for remailer I
to +either B or B. + +=item B{B,B} + +Set B (send out pings to that remailer) for remailer I
to +either B or B. + +=item B{B,B} + +Set B (fetch remailer-key and remailer-conf) for remailer I
to +either B or B. + +=back + =head1 OPTIONS none @@ -161,10 +186,34 @@ Echolot::Globals::init(); if ($COMMAND eq 'add') { - my $address = shift @ARGV; - die ("add requires argument
\n") unless defined $address; - die ("argument
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
\n") unless scalar @ARGV; + my @addresses; + for my $address (@ARGV) { + die ("argument
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"); @@ -186,6 +235,14 @@ if ($COMMAND eq 'add') { $scheduler->run(); + 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 { -- cgit v1.2.3