summaryrefslogtreecommitdiff
path: root/Echolot/Pinger/Mix.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Echolot/Pinger/Mix.pm')
-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: