From 8e615cad321491bade30622b120a4a6fbeff02b3 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 3 Jul 2002 00:54:40 +0000 Subject: Implemented command delete Implemented command getkeyconfs --- Echolot/Commands.pm | 6 +++++- Echolot/Storage/File.pm | 26 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm index 86ea89c..d00f2c0 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.3 2002/07/02 17:03:13 weasel Exp $ +# $Id: Commands.pm,v 1.4 2002/07/03 00:54:40 weasel Exp $ # =pod @@ -67,6 +67,10 @@ sub processCommands($) { Echolot::Globals::get()->{'storage'}->add_address(@args); } elsif ($command eq 'set') { Echolot::Globals::get()->{'storage'}->set_stuff(@args); + } elsif ($command eq 'getkeyconf') { + Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', time() ); + } elsif ($command eq 'delete') { + Echolot::Globals::get()->{'storage'}->delete_remailer(@args); } else { warn("Unkown command: $_\n"); }; diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm index 26b7ed8..cca5015 100644 --- a/Echolot/Storage/File.pm +++ b/Echolot/Storage/File.pm @@ -1,7 +1,7 @@ package Echolot::Storage::File; # (c) 2002 Peter Palfrader -# $Id: File.pm,v 1.19 2002/07/03 00:36:14 weasel Exp $ +# $Id: File.pm,v 1.20 2002/07/03 00:54:40 weasel Exp $ # =pod @@ -915,6 +915,30 @@ sub expire($) { }; +sub delete_remailer($$) { + my ($self, $address) = @_; + + unless (defined $self->{'METADATA'}->{'addresses'}->{$address}) { + delete $self->{'METADATA'}->{'addresses'}->{$address} + } else { + cluck("Remailer $address does not exist in addresses") + }; + + unless (defined $self->{'METADATA'}->{'remailers'}->{$address}) { + + for my $type ( keys %{$self->{'METADATA'}->{'remailers'}->{$address}->{'keys'}} ) { + for my $key ( keys %{$self->{'METADATA'}->{'remailers'}->{$address}->{'keys'}->{$type}} ) { + $self->pingdata_close_one($address, $type, $key, 'delete'); + }; + }; + + delete $self->{'METADATA'}->{'remailers'}->{$address} + } else { + cluck("Remailer $address does not exist in addresses") + }; +}; + + # sub convert($) { # my ($self) = @_; -- cgit v1.2.3