summaryrefslogtreecommitdiff
path: root/Echolot/Report.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Echolot/Report.pm')
-rw-r--r--Echolot/Report.pm46
1 files changed, 46 insertions, 0 deletions
diff --git a/Echolot/Report.pm b/Echolot/Report.pm
new file mode 100644
index 0000000..8df112a
--- /dev/null
+++ b/Echolot/Report.pm
@@ -0,0 +1,46 @@
+package Echolot::Report;
+
+# (c) 2002 Peter Palfrader <peter@palfrader.org>
+# $Id: Report.pm,v 1.1 2003/02/20 19:39:03 weasel Exp $
+#
+
+=pod
+
+=head1 Name
+
+Echolot::Report - Summarize status of remailers
+
+=head1 DESCRIPTION
+
+This package prints the summary of remailers/addresses.
+
+=cut
+
+use strict;
+use English;
+use Echolot::Log;
+
+sub print_summary() {
+
+ my @addresses = sort { $a->{'address'} cmp $b->{'address'} } Echolot::Globals::get()->{'storage'}->get_addresses();
+ my %remailers = map { $_->{'address'} => $_ } Echolot::Globals::get()->{'storage'}->get_remailers();
+ my $report = "*** Status summary ***\n";
+
+ for my $remailer (@addresses) {
+ my $addr = $remailer->{'address'};
+ $report .= "$addr (ID: $remailer->{'id'}): ".uc($remailer->{'status'})."; Fetch/Ping/Show: $remailer->{'fetch'}$remailer->{'pingit'}$remailer->{'showit'}; TTL: $remailer->{'ttl'}\n";
+ $report .= " Resurection TTL: $remailer->{'resurrection_ttl'}\n" if (defined $remailer->{'resurrection_ttl'} && ($remailer->{'status'} eq 'ttl timeout'));
+ if (defined $remailers{$addr}) {
+ $report .= " $remailers{$addr}->{'status'}\n";
+ for my $type (Echolot::Globals::get()->{'storage'}->get_types($addr)) {
+ $report .= " Type: $type: ".join(', ', Echolot::Globals::get()->{'storage'}->get_keys($addr, $type))."\n";
+ };
+ };
+ };
+ Echolot::Log::info($report);
+
+ return 1;
+};
+
+1;
+# vim: set ts=4 shiftwidth=4: