diff options
author | Peter Palfrader <peter@palfrader.org> | 2003-02-17 09:14:47 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2003-02-17 09:14:47 +0000 |
commit | 320e35d1bcdc3952c9a78515a81852379fbf99ce (patch) | |
tree | ea2fded185f5c7139469c24b975b1c1121e69f84 /Echolot/Thesaurus.pm | |
parent | 2123fb6af0fa319ff43286580d035e8f986e4397 (diff) |
Create an index.txt file in the thesaurus directory which holds id, nick, and address for each remailer in the thesaurussnapshot/2003-02-17
Diffstat (limited to 'Echolot/Thesaurus.pm')
-rw-r--r-- | Echolot/Thesaurus.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Echolot/Thesaurus.pm b/Echolot/Thesaurus.pm index afce0d9..6662e5e 100644 --- a/Echolot/Thesaurus.pm +++ b/Echolot/Thesaurus.pm @@ -1,7 +1,7 @@ package Echolot::Thesaurus; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Thesaurus.pm,v 1.14 2003/01/14 05:25:35 weasel Exp $ +# $Id: Thesaurus.pm,v 1.15 2003/02/17 09:14:47 weasel Exp $ # =pod @@ -56,7 +56,7 @@ sub build_thesaurus() { my $data; for my $filename (@files) { - my ($id, $what) = $filename =~ /^(\d+)\.(adminkey|conf|help|key|stats)$/; + my ($id, $what) = $filename =~ /^(\d+)\.(adminkey|conf|help|key|stats)$/; next unless (defined $id && defined $what); my $remailer = Echolot::Globals::get()->{'storage'}->get_address_by_id($id); @@ -84,6 +84,7 @@ sub build_thesaurus() { $data->{$remailer->{'address'}}->{$what.'_href'} = $filename; $data->{$remailer->{'address'}}->{$what.'_date'} = $date; $data->{$remailer->{'address'}}->{$what.'_time'} = $time; + $data->{$remailer->{'address'}}->{'id'} = $id; }; @@ -105,6 +106,16 @@ sub build_thesaurus() { 'thesaurusindexfile', Echolot::Config::get()->{'buildthesaurus'}, remailers => \@data); + + open(F, ">$dir/index.txt") or + Echolot::Log::warn ("Cannot open '$dir/index.txt': $!."), + return 0; + for my $remailer (@data) { + printf F "%s\t%s\t%s\n", $remailer->{'nick'}, $remailer->{'id'}, $remailer->{'address'}; + }; + close(F) or + Echolot::Log::warn ("Cannot close '$dir/index.txt': $!."), + return 0; }; |