chiark / gitweb /
Publish rejections
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Feb 2010 22:22:12 +0000 (22:22 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Feb 2010 22:22:12 +0000 (22:22 +0000)
12 files changed:
.gitignore
cgi/logs.INO
forward-suffix.part.INO
get-settings
install-loggroups
install-newsgroup
install-weblinks
public-html/messages [new symlink]
setup
stump/etc/sanitise_and_quote_email.INO
xlog/bin/record
xlog/bin/report

index 8dc5a05844d818e49760ccaddaaa7a2885045067..d34fba33eb1d740dafe36566e7c34b23af3ef6af 100644 (file)
@@ -14,7 +14,7 @@
 /xlog/log/*/event.log
 /xlog/log/*/event.log.[0-9]
 /xlog/log/*/event.log.[0-9].gz
-/xlog/log/*/nr-*.txt
+/xlog/log/*/public/nr-*.txt
 /crontab.part
 /stump/etc/modenv
 /stump/etc/added-headers
index 9936de24806d6f33a878340c8531405538210904..5c3510ba262c5ccd8d1eb960c2ac4a94bee06af8 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/bash
 set -e
 cd %BASEDIR%/xlog/log
-exec ../bin/report %GROUP% "$@"
+exec ../bin/report %GROUP% %STATICFILESURL%/g.%ABBREV%/messages "$@"
index bf5121a596d1fd62beb0630f7383a4b2b5c9c4e2..1227565243c5b3b76fb6f8129d657aa8786899cb 100644 (file)
@@ -30,7 +30,7 @@ endif
 if $local_part_suffix is +%ABBREV%-internal-log+mailout
 then
        unseen deliver %LOGGROUPEMAILPREFIX%+%ABBREV%+log+mailout
-       pipe "%BASEDIR%/xlog/bin/record mailout %GROUP%"
+       pipe "%BASEDIR%/xlog/bin/record %PUBREJOPT% mailout %GROUP%"
        finish
 endif
 
index f9b3d6f07e54450f4e3dad9a5ba502804c413620..4226b295849c3d42ef847bdd71c9115fecc74977 100644 (file)
@@ -18,6 +18,13 @@ export BASEDIR
 
 # derivative settings:
 
+PUBREJOPT=''
+if $PUBLISHREJECTIONS; then
+       PUBREJOPT=-P
+fi
+export PUBREJOPT
+
+
 test -f persistent-autosettings || touch persistent-autosettings
 . persistent-autosettings
 
index d484a9aa0a5a90ad6e1893eb5c5a7328aa28fcbe..83fea561cbc58515b7992e754fa0539b3593a753 100755 (executable)
@@ -5,7 +5,7 @@ set -e
 
 case ",$NEWSADMINUSERS," in
 *,"`whoami`",*) ;;
-*)     echo >&2 "$0 must be run as one of $NEWSADMINUSERS, skipping"
+*)     echo >&2 "$0 must be run as one of $NEWSADMINUSERS, skipping"; exit 0;;
 esac
 
 exec <mailinglists_dir.part
index 5ec1784c92fafc190c504ea5dfd498dd600b3d21..a9a660a785e44b2f4eb873af7da4d0f4616539f7 100755 (executable)
@@ -9,7 +9,7 @@ mkdir -p stump/tmp/messages
 mkdir -p stump/data
 mkdir -p webstump/queues/$GROUP
 mkdir -p webstump/log
-mkdir -p xlog/log/$GROUP
+mkdir -p xlog/log/$GROUP/public
 
 ngdir=webstump/config/newsgroups/$GROUP
 mkdir -p $ngdir
index 459001c12fa2a9324317073c4333d8dc037111f2..32865b9182ccd5a7552bb7e1ac267d4c972edd70 100755 (executable)
@@ -12,4 +12,3 @@ install_link () {
 install_link $BASEDIR/cgi         $CGISCRIPTDIR/g.$ABBREV
 install_link $BASEDIR/cgi/logs    $CGISCRIPTDIR/l.$ABBREV
 install_link $BASEDIR/public-html $STATICFILESDIR/g.$ABBREV
-
diff --git a/public-html/messages b/public-html/messages
new file mode 120000 (symlink)
index 0000000..29f59e6
--- /dev/null
@@ -0,0 +1 @@
+/home/webstump/live-mtm/xlog/log/misc.test.moderated/public
\ No newline at end of file
diff --git a/setup b/setup
index 2a7c2c08acdc32a9c7d7ac6dfe9c92db8955691c..bf605758f3b3bdc276c40e2349b54b094613bdbd 100755 (executable)
--- a/setup
+++ b/setup
@@ -14,6 +14,7 @@ x ./install-newsgroup
 x ./install-substitutions
 x make -C webstump
 x ./install-aggregates
+x ./install-weblinks
 x ./install-loggroups
 
 echo ==== DONE ====
index a62f34947306dd50d5a02a0366c83c31a39b81c1..9446cd4a081bf104b0d322b9f96d7f915e1a9ad8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -p
 
-s, %OURUSER% \+ [-+/0-9a-z]* \@ (\Q %DOMAIN% | %SLIMYDOMAIN \E) \b
+s, %OURUSER% \+ [-+/0-9a-z]* \@ (\Q%DOMAIN%\E | \Q%SLIMYDOMAIN%\E) \b
                 ,%OURUSER%+?\@$1,igx
        unless m/^$/..0;
 
index a62819575b6584d67c92da38f713c89236243aae..11c7e605678d4d0dc8339506be5c3e243d45fa3a 100755 (executable)
@@ -4,6 +4,13 @@ use strict (qw(vars));
 use IO::Handle;
 
 our %f;
+
+my $publish_rejections= 0;
+if ($ARGV[0] eq '-P') {
+    $publish_rejections= 1;
+    shift @ARGV;
+}
+
 our ($how) = @_;
 
 my $dir= $0;
@@ -77,7 +84,9 @@ sub parse_mailout () {
     while (<STDIN>) {
        $keepheader= 1 unless m/^[ \t]/;
        $keepheader= 0
-           if m/^(?: received )/ix;
+           if m/^(?: received
+                  | envelope-to
+                  )/ix;
        $keepheader= 'mangle'
            if m/^(?: to
                   | from
@@ -110,9 +119,11 @@ STDIN->error and die $!;
 
 $f{Now}= time;
 
-if ($f{Event} =~ m/^notify reject /) {
-    #$ref= $f{MessageID}
-    open I, ">$dir/nr-$f{MessageNum}.txt" or die $!;
+if ($publish_rejections &&
+    $f{Event} =~ m/^notify reject /) {
+    $f{CopyRef}= $f{MessageID};
+    $f{CopyRef} =~ s/\W/ sprintf '-%02x', ord($&) /ge;
+    open I, ">$dir/public/nr-$f{CopyRef}.txt" or die $!;
     print I $message or die $!;
     close I or die $!;
 }
@@ -125,7 +136,7 @@ my @s= map {
     $v =~ s/\t/  /g;
     $v =~ s/[\r\n]/?/g;
     $v;
-} qw(Now MessageNum MessageID From Subject Event);
+} qw(Now MessageNum MessageID From Subject Event CopyRef);
 
 print L join("\t",@s)."\n" or die $!;
 close L or die $!;
index ee3022ea17cfaa444fb3be9e198cae58e01f83ab..5f747694de71d9294274fff11cac085320bcb892 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-our ($ng,@ARGV) = @ARGV;
+our ($ng,$staticfiles,@ARGV) = @ARGV;
 chdir $ng or die $!;
 
 use strict (qw(vars));
@@ -34,7 +34,7 @@ sub processlogs ($) {
 sub processline_print () {
     my @sp= @s;
     $sp[3] =~ s/\@\w{0,2}/ at .. /;
-    my @sp= map { escapeHTML($_) } @sp;
+    @sp= map { escapeHTML($_) } @sp[0..5];
     my @spu= map {
        s/\W/ sprintf "%%%02x", ord $& /ge;
        $_;
@@ -45,6 +45,9 @@ sub processline_print () {
            $sp[$i]= a({ href=>$url }, $sp[$i] );
        }
     }
+    if (length $s[6]) {
+       $sp[5]= a({ href=>"$staticfiles/nr-$s[6].txt" }, $sp[5] );
+    }
 #print STDERR join('|',@sp),"\n";
     print Tr(td([@sp]));
 }
@@ -87,7 +90,7 @@ if ($pi =~ m,^/message/(\d+)/(.*)$,) {
     $title= "Single message ".escapeHTML($selectmid);
     $processline= \&processline_print_ifsingle;
 } elsif ($pi =~ m/^$/) {
-    $title= "Recent activity";
+    $title= "Recent activity - $ng";
 } elsif ($pi =~ m,^/queue,) {
     $title= "Activity regarding still-queued messages";
     $processline= \&processline_queue_prescan;