X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fimportwwv.pl;h=f0fcfec0d651d093e7563e009144105bbbeee0e8;hb=refs%2Fheads%2Fnewpc92timings;hp=bca63688e28751f68dd1817f42524787f8bd126d;hpb=45495d980ec748f19509c7668d6b92a06f216ed7;p=spider.git diff --git a/perl/importwwv.pl b/perl/importwwv.pl index bca63688..f0fcfec0 100755 --- a/perl/importwwv.pl +++ b/perl/importwwv.pl @@ -11,7 +11,7 @@ # # Copyright (c) 2004 Dirk Koopman G1TLH # -# $Id$ +# # use strict; @@ -37,7 +37,7 @@ my $msg = Mail::Internet->new(\*STDIN) or die "Mail::Internet $!"; my $head = $msg->head->header_hashref; if ($head) { - if ($head->{From}->[0] =~ /wwv/i || $head->{'From '}->[0] =~ /wwv/i) { + if ($head->{Subject}->[0] =~ /wwv/i) { process_wwv($msg); } elsif ($head->{From}->[0] =~ /rwc\.boulder/i || $head->{'From '}->[0] =~ /rwc\.boulder/i) { process_solar($msg); @@ -62,6 +62,7 @@ sub process_wwv } if ($state) { my $l = $_; + next if /\bSec\b/i; $l =~ s/\s*\.?\r?\n$//; push @out, $l; } @@ -87,6 +88,7 @@ sub process_solar } if ($state > 1) { my $l = $_; + next if /\bSec\b/i; $l =~ s/\r?\n$//; push @out, $l; } @@ -99,8 +101,13 @@ sub out my $fn = "solar.txt.$$"; open OUT, ">$tmp/$fn" or die "import $tmp/$fn $!"; + chmod 0666, "$tmp/$fn"; print OUT map { "$_\n" } @_; close OUT; + + # Note we do this this way to make the appearance of + # the file in /spider/chat_import atomic. Otherwise there + # exists the possiblity of race conditions and other nasties link "$tmp/$fn", "$import/$fn"; unlink "$tmp/$fn"; }