summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7395bdc)
This is done by creating
BASEDIR/settings.publish-rejection-kinds
with a series of lines of the form
[!]<glob-pattern>
where <glob-pattern> may contain * and ? and matches the short
rejection reason keyword. First match wins; ! means do not publish;
if file does not exist or we run off the end, we do publish.
All of this depends on PUBLISHREJECTIONS=true in settings.
+/settings.publish-rejections-kinds
/moderators
/persistent-autosettings
/moderators
/persistent-autosettings
PUBREJOPT=''
if $PUBLISHREJECTIONS; then
PUBREJOPT=''
if $PUBLISHREJECTIONS; then
+ PUBREJOPT="-P$BASEDIR/settings.publish-rejection-kinds"
use strict (qw(vars));
use IO::Handle;
use strict (qw(vars));
use IO::Handle;
+my $publish_rejections_patfile= '/dev/null';
my $publish_rejections= 0;
if ($ARGV[0] eq '-P') {
$publish_rejections= 1;
shift @ARGV;
my $publish_rejections= 0;
if ($ARGV[0] eq '-P') {
$publish_rejections= 1;
shift @ARGV;
+} elsif ($ARGV[0] =~ s/^\-P//) {
+ $publish_rejections= 1;
+ $publish_rejections_patfile= shift @ARGV;
+sub want_publish_rejection_kind ($) {
+ my ($kind) = @_;
+ return 1 if $publish_rejections_patfile eq '';
+ if (!open PF, '<', $publish_rejections_patfile) {
+ return 1 if $!==&ENOENT;
+ die "$publish_rejections_patfile: $!";
+ }
+ while (<PF>) {
+ s/^\s+//;
+ s/\s+$//;
+ next if m/^\#/;
+ next unless m/\S/;
+ my $yn = !s/^\!//;
+ s/[^0-9a-zA-Z*?]/\\$&/g;
+ s/\*/.*/g;
+ s/\?/./g;
+ return $yn if $kind =~ m/^$_$/;
+ }
+ close PF or die $!;
+ return 1;
+}
+
if ($publish_rejections &&
if ($publish_rejections &&
- $f{Event} =~ m/^notify reject /) {
+ $f{Event} =~ m/^notify reject (\S+)/ &&
+ want_publish_rejection_kind($1))
+{
$f{CopyRef}= $f{MessageNum} || $f{MessageID};
$f{CopyRef} =~ s/\W/ sprintf '-%02x', ord($&) /ge;
open I, ">$dir/public/nr-$f{CopyRef}.txt" or die $!;
$f{CopyRef}= $f{MessageNum} || $f{MessageID};
$f{CopyRef} =~ s/\W/ sprintf '-%02x', ord($&) /ge;
open I, ">$dir/public/nr-$f{CopyRef}.txt" or die $!;