summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-02-18 06:38:34 +0000
committerPeter Palfrader <peter@palfrader.org>2003-02-18 06:38:34 +0000
commit4a14e35aa72f11b04fac87d1ebc8cf8f1e2828e1 (patch)
tree6efaaa4a5a31a08e387bfd658630cd81cc14a4b7 /Echolot
parent8008d99c22778c8735d4ad24352a61e2d7c17d84 (diff)
List From: headers
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Chain.pm4
-rw-r--r--Echolot/Commands.pm4
-rw-r--r--Echolot/Config.pm5
-rw-r--r--Echolot/Log.pm11
-rw-r--r--Echolot/Stats.pm4
-rw-r--r--Echolot/Storage/File.pm51
-rw-r--r--Echolot/Tools.pm13
7 files changed, 57 insertions, 35 deletions
diff --git a/Echolot/Chain.pm b/Echolot/Chain.pm
index dcf6647..1a380d7 100644
--- a/Echolot/Chain.pm
+++ b/Echolot/Chain.pm
@@ -1,7 +1,7 @@
package Echolot::Chain;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Chain.pm,v 1.8 2003/02/17 14:44:15 weasel Exp $
+# $Id: Chain.pm,v 1.9 2003/02/18 06:38:06 weasel Exp $
#
=pod
@@ -198,7 +198,7 @@ sub set_intensive_care($@) {
%{$INTENSIVE_CARE{$chaintype}} = map { ($_->{'addr1'}.' '.$_->{'addr2'}) => $_->{'reason'} } @$intensive_care;
if (scalar @$intensive_care) {
- Echolot::Log::debug("intensive care $chaintype:\n" . join("\n", map { "\t\t$_: $INTENSIVE_CARE{$chaintype}->{$_}" } keys %{$INTENSIVE_CARE{$chaintype}} ));
+ Echolot::Log::debug("intensive care $chaintype:\n" . join("\n", map { "$_: $INTENSIVE_CARE{$chaintype}->{$_}" } keys %{$INTENSIVE_CARE{$chaintype}} ));
} else {
Echolot::Log::debug("intensive care $chaintype: (none)");
};
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm
index c370ec1..e0d7e5e 100644
--- a/Echolot/Commands.pm
+++ b/Echolot/Commands.pm
@@ -1,7 +1,7 @@
package Echolot::Commands;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Commands.pm,v 1.12 2003/01/14 05:25:34 weasel Exp $
+# $Id: Commands.pm,v 1.13 2003/02/18 06:38:07 weasel Exp $
#
=pod
@@ -77,6 +77,8 @@ sub processCommands($) {
Echolot::Globals::get()->{'scheduler'}->schedule('buildkeys', 0, time() );
} elsif ($command eq 'buildthesaurus') {
Echolot::Globals::get()->{'scheduler'}->schedule('buildthesaurus', 0, time() );
+ } elsif ($command eq 'buildfromlines') {
+ Echolot::Globals::get()->{'scheduler'}->schedule('buildfromlines', 0, time() );
} elsif ($command eq 'delete') {
Echolot::Globals::get()->{'storage'}->delete_remailer(@args);
} elsif ($command eq 'setremailercaps') {
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index 9561d55..4c887cd 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.58 2003/02/17 14:44:15 weasel Exp $
+# $Id: Config.pm,v 1.59 2003/02/18 06:38:08 weasel Exp $
#
=pod
@@ -88,6 +88,7 @@ sub init($) {
buildstats => 5*60, # build statistics every 5 minutes
buildkeys => 8*60*60, # build keyring every 8 hours
buildthesaurus => 60*60, # hourly
+ buildfromlines => 60*60, # hourly
commitprospectives => 8*60*60, # commit prospective addresses every 8 hours
expire => 24*60*60, # daily
getkeyconf_interval => 5*60, # send out requests every 5 minutes
@@ -130,6 +131,7 @@ sub init($) {
resultdir => 'results',
thesaurusdir => 'results/thesaurus',
thesaurusindexfile => 'results/thesaurus/index',
+ fromlinesindexfile => 'results/from',
private_resultdir => 'results.private',
indexfilebasename => 'echolot',
gnupghome => 'gnupghome',
@@ -180,6 +182,7 @@ sub init($) {
default => {
'indexfile' => 'templates/echolot.html',
'thesaurusindexfile' => 'templates/thesaurusindex.html',
+ 'fromlinesindexfile' => 'templates/fromlinesindex.html',
'mlist' => 'templates/mlist.html',
'mlist2' => 'templates/mlist2.html',
'rlist' => 'templates/rlist.html',
diff --git a/Echolot/Log.pm b/Echolot/Log.pm
index 5078835..7e60612 100644
--- a/Echolot/Log.pm
+++ b/Echolot/Log.pm
@@ -1,7 +1,7 @@
package Echolot::Log;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Log.pm,v 1.6 2003/01/14 07:38:27 weasel Exp $
+# $Id: Log.pm,v 1.7 2003/02/18 06:38:09 weasel Exp $
#
=pod
@@ -42,11 +42,10 @@ sub header_log($$) {
$monnames[$mon],
$mday,
$hour, $min, $sec);
- my $logstring = $time.' '.
- '['.uc($level).']'. ' '.
- $msg;
- $logstring =~ s/\n/\n /mg;
- $logstring .= "\n";
+ my $prefix = $time.' ['.uc($level).'] ';
+ my $logstring = $msg."\n";
+ my $first = 0;
+ $logstring =~ s/^/ $prefix . ($first++ ? ' ' : '' ) /emg;
return $logstring;
};
diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm
index 4575562..a91dc57 100644
--- a/Echolot/Stats.pm
+++ b/Echolot/Stats.pm
@@ -1,7 +1,7 @@
package Echolot::Stats;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Stats.pm,v 1.48 2003/02/17 07:22:49 weasel Exp $
+# $Id: Stats.pm,v 1.49 2003/02/18 06:38:09 weasel Exp $
#
=pod
@@ -532,7 +532,7 @@ sub find_broken_chains($$$) {
my $done = $stats->{$addr1}->{$addr2}->{'done'};
$done = 0 unless defined $done;
($out < Echolot::Config::get()->{'chainping_minsample'} && $done == 0) and
- push (@intensive_care, { addr1 => $addr1, addr2 => $addr2, reason => "only $out samples, none returned so far" }),
+ push (@intensive_care, { addr1 => $addr1, addr2 => $addr2, reason => "only $out sample".($out>1?'s':'').", none returned so far" }),
next;
($out > 0) or
Echolot::Log::debug("Should not devide through zero ($done/$out) for $addr1, $addr2."),
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index 46ddbd5..25d6406 100644
--- a/Echolot/Storage/File.pm
+++ b/Echolot/Storage/File.pm
@@ -1,7 +1,7 @@
package Echolot::Storage::File;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: File.pm,v 1.52 2003/02/17 14:44:15 weasel Exp $
+# $Id: File.pm,v 1.53 2003/02/18 06:38:10 weasel Exp $
#
=pod
@@ -1522,6 +1522,10 @@ Returns undef on errors.
sub get_nick($$) {
my ($self, $remailer) = @_;
+ defined $remailer or
+ Echolot::Log::cluck ("Undefined remailer passed to get_nick()."),
+ return undef;
+ return undef unless defined $self->{'METADATA'}->{'remailers'}->{$remailer};
return undef unless defined $self->{'METADATA'}->{'remailers'}->{$remailer}->{'conf'};
return $self->{'METADATA'}->{'remailers'}->{$remailer}->{'conf'}->{'nick'};
};
@@ -1739,7 +1743,7 @@ sub delete_remailercaps($$) {
Register that the remailer I<$address> returned the From header
line I<$from>. If I<$with_from> is 1 we had tried to supply our own
-From, otherwhise not.
+From, otherwise not.
Returns 1, undef on error.
@@ -1773,34 +1777,37 @@ sub register_fromline($$$$) {
};
-=item $storage->B<get_fromlines>()
+=item $storage->B<get_fromline>( I<$addr>, I<$type>, I<$user_supplied> )
Return a hash reference with header From line information.
-The key is the remailer address. This points to a hash of types (mix,
-cpunk-rsa, ..) which point to another hash with keys B<0> (no user supplied
-From header tried) and B<1> (a user supplied From header was given). These
-point to yet another hash with keys B<last_update> and B<from>.
+The hash has two keys, B<last_update> and B<from>, which holds the actual information.
+
+If there is no from line registered for the given combination, undef is returned.
+
+On Error, also undef is returned.
=cut
-sub get_fromlines($) {
- my ($self) = @_;
+sub get_fromline($$$$) {
+ my ($self, $addr, $type, $user_supplied) = @_;
- my $result;
- # rebuilding it so that external things cannot screw up our structure
- for my $remailer_addr ( keys %{$self->{'METADATA'}->{'fromlines'}} ) {
- for my $type ( keys %{$self->{'METADATA'}->{'fromlines'}->{$remailer_addr}} ) {
- for my $user_supplied ( keys %{$self->{'METADATA'}->{'fromlines'}->{$remailer_addr}->{$type}} ) {
- $result->{$remailer_addr}->{$user_supplied} = {
- last_update => $self->{'METADATA'}->{'fromlines'}->{$remailer_addr}->{$type}->{$user_supplied}->{'last_update'},
- from => $self->{'METADATA'}->{'fromlines'}->{$remailer_addr}->{$type}->{$user_supplied}->{'from'}
- };
- };
- };
- };
+ defined $self->{'METADATA'}->{'fromlines'}->{$addr} or
+ return undef;
+ defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type} or
+ return undef;
+ defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied} or
+ return undef;
- return $result;
+ defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'last_update'} or
+ Echolot::Log::cluck ("last_update is undefined with $addr $type $user_supplied."),
+ return undef;
+ defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'from'} or
+ Echolot::Log::cluck ("from is undefined with $addr $type $user_supplied."),
+ return undef;
+
+ return { last_update => $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'last_update'},
+ from => $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'from'} };
}
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index 88dd0d2..9643d78 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -1,7 +1,7 @@
package Echolot::Tools;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Tools.pm,v 1.18 2003/02/16 10:24:45 weasel Exp $
+# $Id: Tools.pm,v 1.19 2003/02/18 06:38:09 weasel Exp $
#
=pod
@@ -204,6 +204,17 @@ sub write_meta_information($%) {
return 1;
};
+sub escape_HTML_entities($) {
+ my ($in) = @_;
+
+ $in =~ s/&/&amp;/;
+ $in =~ s/"/&quot;/;
+ $in =~ s/</&lt;/;
+ $in =~ s/>/&gt;/;
+
+ return $in;
+};
+
sub write_HTML_file($$;$%) {
my ($origfile, $template_file, $expire, %templateparams) = @_;