Merge branch 'Options'
authorThomas Hochstein <thh@inter.net>
Thu, 25 Feb 2010 18:22:15 +0000 (19:22 +0100)
committerThomas Hochstein <thh@inter.net>
Thu, 25 Feb 2010 18:22:15 +0000 (19:22 +0100)
Conflicts:
yapfaq.pl

1  2 
yapfaq.pl

diff --cc yapfaq.pl
+++ b/yapfaq.pl
@@@ -84,10 -95,20 +95,16 @@@ foreach (@Config) 
  
    $SupersedeMID = "" unless $Supersede;
  
 -  if ($PFreq =~ /(\d+)\s*([dw])/) { # Is counted in days or weeks: Use Add_Delta_Days.
 -    ($NPY,$NPM,$NPD) = Add_Delta_Days($LPY, $LPM, $LPD, (($2 eq "w")?$1 * 7: $1 * 1));
 -  } elsif ($PFreq =~ /(\d+)\s*([my])/) { #Is counted in months or years: Use Add_Delta_YM
 -    ($NPY,$NPM,$NPD) = Add_Delta_YM($LPY, $LPM, $LPD, (($2 eq "m")?(0,$1):($1,0)));
 -  }
 -    
 +  ($NPY,$NPM,$NPD) = calcdelta ($LPY,$LPM,$LPD,$PFreq);
 +
-   if (Delta_Days($NPY,$NPM,$NPD,$TDY,$TDM,$TDD) >= 0 ) {
-     postfaq(\$ActName,\$File,\$From,\$Subject,\$NG,\$Fup2,\$MIDF,\$ExtHea,\$Sender,\$TDY,\$TDM,\$TDD,\$ReplyTo,\$SupersedeMID,\$Expire);
+   if (Delta_Days($NPY,$NPM,$NPD,$TDY,$TDM,$TDD) >= 0 or ($Options{'p'})) {
+     if($Options{'d'}) {
+         print "$ActName: Would be posted now (but running in simulation mode [$0 -d]).\n" if $Options{'v'};
+       } else {
 -      postfaq(\$ActName,\$File,\$From,\$Subject,\$NG,\$Fup2,\$MIDF,\$ExtHea,\$Sender,\$TDY,\$TDM,\$TDD,\$ReplyTo,\$SupersedeMID);
++      postfaq(\$ActName,\$File,\$From,\$Subject,\$NG,\$Fup2,\$MIDF,\$ExtHea,\$Sender,\$TDY,\$TDM,\$TDD,\$ReplyTo,\$SupersedeMID,\$Expire);
+       }
+   } elsif($Options{'v'}) {
+     print "$ActName: Nothing to do.\n";
    }
  }
  
@@@ -159,9 -166,13 +182,13 @@@ sub calcdelta 
  # It reads the data-file $File and then posts the article.
  
  sub postfaq {
 -  my ($ActName,$File,$From,$Subject,$NG,$Fup2,$MIDF,$ExtraHeaders,$Sender,$TDY,$TDM,$TDD,$ReplyTo,$Supersedes) = @_;
 +  my ($ActName,$File,$From,$Subject,$NG,$Fup2,$MIDF,$ExtraHeaders,$Sender,$TDY,$TDM,$TDD,$ReplyTo,$Supersedes,$Expire) = @_;
    my (@Header,@Body,$MID,$InRealBody,$LastModified);
  
+   if($Options{'v'}) {
+     print "$$ActName: Preparing to post.\n";
+   }
+   
    #Prepare MID:
    $$TDM = ($$TDM < 10 && $$TDM !~ /^0/) ? "0" . $$TDM : $$TDM;
    $$TDD = ($$TDD < 10 && $$TDD !~ /^0/) ? "0" . $$TDD : $$TDD;
This page took 0.012877 seconds and 4 git commands to generate.