diff options
author | Peter Palfrader <peter@palfrader.org> | 2002-06-18 17:21:51 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2002-06-18 17:21:51 +0000 |
commit | 1814eb9be9158e80fd40d05849bc87f640f1d8a5 (patch) | |
tree | 1eb43da71e8ed42dc3f694cef7b36394734c9032 | |
parent | eee7c10a80ad19dfa04e846b1fffd8a2d5ed31c0 (diff) |
Added cpunk pinging
-rw-r--r-- | Echolot/Pinger.pm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Echolot/Pinger.pm b/Echolot/Pinger.pm index 0ca1ae6..824525c 100644 --- a/Echolot/Pinger.pm +++ b/Echolot/Pinger.pm @@ -1,7 +1,7 @@ package Echolot::Pinger; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Pinger.pm,v 1.5 2002/06/13 15:26:50 weasel Exp $ +# $Id: Pinger.pm,v 1.6 2002/06/18 17:21:51 weasel Exp $ # =pod @@ -21,6 +21,7 @@ use warnings; use Carp qw{cluck}; use English; use Echolot::Pinger::Mix; +use Echolot::Pinger::CPunk; sub makeHash($) { my ($text) = @_; @@ -38,13 +39,29 @@ sub do_mix_ping($$$$$) { Echolot::Pinger::Mix::ping( $body, $to, - $key{'nick'}, + [ $key{'nick'} ], { $keyid => \%key } ) or return 0; return 1; }; +sub do_cpunk_ping($$$$$$) { + my ($address, $type, $keyid, $time, $to, $body) = @_; + + my %key = Echolot::Globals::get()->{'storage'}->get_key($address, $type, $keyid); + Echolot::Pinger::CPunk::ping( + $body, + $to, + [ { address => $address, + keyid => $keyid } ], + { $keyid => \%key }, + $type eq 'cpunk-rsa' ) or + return 0; + + return 1; +}; + sub do_ping($$$) { my ($type, $address, $key) = @_; @@ -60,6 +77,8 @@ sub do_ping($$$) { my $to = Echolot::Tools::make_address('ping'); if ($type eq 'mix') { do_mix_ping($address, $key, $now, $to, $body); + } elsif ($type eq 'cpunk-rsa' || $type eq 'cpunk-dsa') { + do_cpunk_ping($address, $type, $key, $now, $to, $body); } else { cluck ("Don't know how to handle ping type $type"); return 0; @@ -86,6 +105,7 @@ sub send_pings() { for my $type (Echolot::Globals::get()->{'storage'}->get_types($remailer)) { for my $key (Echolot::Globals::get()->{'storage'}->get_keys($remailer, $type)) { + print "ping calling $type, $remailer, $key\n"; do_ping($type, $remailer, $key); } }; |