X-Git-Url: https://code.th-h.de/?p=usenet%2Fyapfaq.git;a=blobdiff_plain;f=yapfaq.pl;h=9819864c31f49f5d8fd285a0edae07d7b9707b4a;hp=cbcea37b249f817ef7dc30199c44ddb4fc8f5846;hb=b802358a609325e98df470b14827ff01a06f47ee;hpb=2ef9b9cd23aa25fa81a093176121f5bc09b5953d diff --git a/yapfaq.pl b/yapfaq.pl index cbcea37..9819864 100644 --- a/yapfaq.pl +++ b/yapfaq.pl @@ -1,6 +1,6 @@ #! /usr/bin/perl -W # -# yapfaq Version 0.6 by Thomas Hochstein +# yapfaq Version 0.7 by Thomas Hochstein # (Original author: Marc Brockschmidt) # # This script posts any project described in its config-file. Most people @@ -12,7 +12,7 @@ # It can be redistributed and/or modified under the same terms under # which Perl itself is published. -my $Version = "0.6.2"; +my $Version = "0.8-prelease"; my $RCFile = '.yapfaqrc'; my @ValidConfVars = ('NNTPServer','NNTPUser','NNTPPass','Sender','ConfigFile', @@ -20,7 +20,7 @@ my @ValidConfVars = ('NNTPServer','NNTPUser','NNTPPass','Sender','ConfigFile', 'PathtoPGPPass','pgpbegin','pgpend','pgptmpf','pgpheader'); ################################### Defaults ################################## -my %Config = (NNTPServer => "localhost", +my %Config = (NNTPServer => "", NNTPUser => "", NNTPPass => "", Sender => "", @@ -166,7 +166,7 @@ sub readconfig{ my ($File, $Config, $Faq) = @_; my ($LastEntry, $Error, $i) = ('','',0); - print "Reading configuration.\n" if($Options{'v'}); + print "Reading configuration from $$File.\n" if($Options{'v'}); open FH, "<$$File" or die "$0: E: Can't open $$File: $!"; while () { @@ -207,10 +207,12 @@ sub readconfig{ $Error .= "E: The Posting-frequency for your project \"$$Config[$i]{'name'}\" is invalid.\n" } unless(!$$Config[$i]{'expires'} || $$Config[$i]{'expires'} =~ /^\s*\d+\s*[dwmy]\s*$/) { - warn "$0: W: The Expires for your project \"$$Config[$i]{'name'}\" is invalid - set to 3 month.\n"; + warn "$0: W: The Expires for your project \"$$Config[$i]{'name'}\" is invalid - set to 3 month.\n"; + $$Config[$i]{'expires'} = '3m'; # set default (3 month) if expires is unset or invalid } - unless(defined($$Config[$i]{'mid-format'}) && $$Config[$i]{'mid-format'} =~ /^<\S+\@\S{2,}\.\S{2,}>$/) { - warn "$0: W: The Message-ID format for your project \"$$Config[$i]{'name'}\" seems to be undefined or invalid - set to default.\n"; + unless(!$$Config[$i]{'mid-format'} || $$Config[$i]{'mid-format'} =~ /^<\S+\@\S{2,}\.\S{2,}>$/) { + warn "$0: W: The Message-ID format for your project \"$$Config[$i]{'name'}\" seems to be invalid - set to default.\n"; + $$Config[$i]{'mid-format'} = '<%n-%d.%m.%y@'.hostfqdn.'>'; # set default if mid-format is invalid } } $Error .= "-" x 25 . 'program terminated' . "-" x 25 . "\n" if $Error; @@ -264,7 +266,7 @@ sub postfaq { $$TDD = ($$TDD < 10 && $$TDD !~ /^0/) ? "0" . $$TDD : $$TDD; $MID = $$MIDF; - $MID = '<%n-%d.%m.%y@'.hostfqdn.'>' if !defined($MID); + $MID = '<%n-%d.%m.%y@'.hostfqdn.'>' if !defined($MID); # set to default if unset $MID =~ s/\%n/$$ActName/g; $MID =~ s/\%d/$$TDD/g; $MID =~ s/\%m/$$TDM/g; @@ -635,7 +637,7 @@ or Ionths> or Iears>. This value must be set. -=item B = I