summaryrefslogtreecommitdiff
path: root/Echolot/Pinger
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-06-11 09:53:35 +0000
committerPeter Palfrader <peter@palfrader.org>2002-06-11 09:53:35 +0000
commit7a234c06420ece9f0f100107b05cd061b0471b5b (patch)
tree17246819ec7c1bcb6bba844df1421d9099e456e1 /Echolot/Pinger
parenta71fb93482962a7c49d088a233c7c8496c3e2f66 (diff)
Initial Import
Diffstat (limited to 'Echolot/Pinger')
-rw-r--r--Echolot/Pinger/Mix.pm49
1 files changed, 49 insertions, 0 deletions
diff --git a/Echolot/Pinger/Mix.pm b/Echolot/Pinger/Mix.pm
new file mode 100644
index 0000000..afe957f
--- /dev/null
+++ b/Echolot/Pinger/Mix.pm
@@ -0,0 +1,49 @@
+package Echolot::Pinger::Mix;
+
+# (c) 2002 Peter Palfrader <peter@palfrader.org>
+# $Id: Mix.pm,v 1.1 2002/06/11 09:53:35 weasel Exp $
+#
+
+=pod
+
+=head1 Name
+
+Echolot::Pinger::Mix - send mix pings
+
+=head1 DESCRIPTION
+
+This package provides functions for sending mixmaster (type II) pings.
+
+=cut
+
+use strict;
+use warnings;
+use Carp qw{cluck};
+use English;
+
+sub ping($$$$) {
+ my ($body, $to, $chain, $keys) = @_;
+
+ my $keyring = Echolot::Config::get()->{'Pinger::Mix'}->{'mixdir'}.'/pubring.mix';
+ open (F, '>'.$keyring) or
+ cluck("Cannot open $keyring for writing: $!"),
+ return 0;
+ for my $keyid (keys %$keys) {
+ print (F $keys->{$keyid}->{'summary'}, "\n\n");
+ print (F $keys->{$keyid}->{'key'},"\n\n");
+ };
+ close (F) or
+ cluck("Cannot close $keyring"),
+ return 0;
+
+ open(MIX, "|".Echolot::Config::get()->{'Pinger::Mix'}->{'mix'}." -m -S -l $chain") or
+ cluck("Cannot exec mixpinger: $!"),
+ return 0;
+ print MIX "To: $to\n\n$body";
+ close (MIX);
+
+ return 1;
+};
+
+1;
+# vim: set ts=4 shiftwidth=4: