X-Git-Url: https://code.th-h.de/?p=usenet%2Fyapfaq.git;a=blobdiff_plain;f=yapfaq.pl;h=df69b78fe8c7db26330c1e78f181731fc38d8a60;hp=50928277f62f6c05974e72e89055c2e5a843d147;hb=8f067a2ffbcd6ee90bf1e5e1d50996ea7677436d;hpb=ace701c4a66620857f468a138c29caeef8e9183d diff --git a/yapfaq.pl b/yapfaq.pl index 5092827..df69b78 100644 --- a/yapfaq.pl +++ b/yapfaq.pl @@ -12,15 +12,20 @@ # It can be redistributed and/or modified under the same terms under # which Perl itself is published. -my $Version = "0.7"; +my $Version = "0.8-prelease"; +# Please do not change this setting! +# You may override the default .rc file (.yapfaqrc) by using "-c .rc file" my $RCFile = '.yapfaqrc'; +# Valid configuration variables for use in a .rc file my @ValidConfVars = ('NNTPServer','NNTPUser','NNTPPass','Sender','ConfigFile', 'UsePGP','pgp','PGPVersion','PGPSigner','PGPPass', 'PathtoPGPPass','pgpbegin','pgpend','pgptmpf','pgpheader'); -################################### Defaults ################################## -my %Config = (NNTPServer => "localhost", +################################### Defaults ################################### +# Please do not change anything in here! +# Use a runtime configuration file (.yapfaqrc by default) to override defaults. +my %Config = (NNTPServer => "", NNTPUser => "", NNTPPass => "", Sender => "", @@ -50,7 +55,7 @@ my @PGPorderheaders = ('from', 'newsgroups', 'subject', 'control', 'content-transfer-encoding', 'summary', 'keywords', 'cancel-lock', 'cancel-key', 'also-control', 'x-pgp', 'user-agent'); -############################# End of Configuration ############################# +################################# Main program ################################# use strict; use Net::NNTP; @@ -166,7 +171,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 () { @@ -210,7 +215,7 @@ sub readconfig{ 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(!$$Config[$i]{'mid-format'} || $$Config[$i]{'mid-format'} =~ /^<\S+\@\S{2,}\.\S{2,}>$/) { + unless(!$$Config[$i]{'mid-format'} || $$Config[$i]{'mid-format'} =~ /^<\S+\@(\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 } @@ -264,6 +269,7 @@ sub postfaq { #Prepare MID: $$TDM = ($$TDM < 10 && $$TDM !~ /^0/) ? "0" . $$TDM : $$TDM; $$TDD = ($$TDD < 10 && $$TDD !~ /^0/) ? "0" . $$TDD : $$TDD; + my $Timestamp = time; $MID = $$MIDF; $MID = '<%n-%d.%m.%y@'.hostfqdn.'>' if !defined($MID); # set to default if unset @@ -271,6 +277,7 @@ sub postfaq { $MID =~ s/\%d/$$TDD/g; $MID =~ s/\%m/$$TDM/g; $MID =~ s/\%y/$$TDY/g; + $MID =~ s/\%t/$Timestamp/g; #Now get the body: open (FH, "<$$File"); @@ -572,7 +579,7 @@ yapfaq - Post Usenet FAQs I<(yet another postfaq)> =head1 SYNOPSIS -B [B<-hvpd>] [B<-t> I | CONSOLE] [B<-f> I] [B<-s> I] [B<-c> I<.rc file>] +B [B<-Vhvpd>] [B<-t> I | CONSOLE] [B<-f> I] [B<-s> I] [B<-c> I<.rc file>] =head1 REQUIREMENTS @@ -684,8 +691,9 @@ A pattern from which the message ID is generated as it will appear in the Message-ID header of the message. You may use the special strings C<%n> for the I of your project, -C<%d> for the date the message is posted, C<%m> for the month and -C<%y> for the year, respectively. +C<%d> for the date the message is posted, C<%m> for the month, C<%y> +for the year and C<%t> for a time stamp (number of seconds since the +epoch), respectively. This setting is optional; the default is '<%n-%d.%m.%y@I>' where I is the fully qualified domain name (FQDN) of the @@ -944,9 +952,26 @@ if it is due: yapfaq -t de.test -f myfaq +Post all FAQs (that are due for posting) using inews from INN: + + yapfaq -s inews + +Do a dry run using a runtime configuration from .alternaterc, showing +which FAQs would be posted: + + yapfaq -dvc .alternaterc + =head1 ENVIRONMENT -There are no special environment variables used by B. +=over 4 + +=item NNTPSERVER + +The default NNTP server to post to, used by the Net::NNTP module. You +can also specify the server using the runtime configuration file (by +default F<.yapfaqrc>). + +=back =head1 FILES