chiark / gitweb /
Merge branch 'master' of /u/webstump/live/
authorWebSTUMP <webstump@chiark.greenend.org.uk>
Wed, 11 Oct 2017 12:27:27 +0000 (13:27 +0100)
committerWebSTUMP <webstump@chiark.greenend.org.uk>
Wed, 11 Oct 2017 12:27:27 +0000 (13:27 +0100)
cgi/logs.INO
get-settings
webstump/scripts/filter.lib.pl
xlog/bin/record
xlog/bin/report

index 5c3510ba262c5ccd8d1eb960c2ac4a94bee06af8..9871e61721538b64c1525ea7356f64db55d58ebe 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/bash
 set -e
 cd %BASEDIR%/xlog/log
-exec ../bin/report %GROUP% %STATICFILESURL%/g.%ABBREV%/messages "$@"
+exec ../bin/report %LOGREPORTOPTS% %GROUP% %STATICFILESURL%/g.%ABBREV%/messages "$@"
index 3250905eece6aacaf33aeea436826c35bd7b5ac0..8e2fd03b3aea3c1e08a0a5f058e55c8ea7edda80 100644 (file)
@@ -7,10 +7,11 @@ for k in $pas; do eval "$k=''"; export $k; done
 DIVERTPOSTINGS=''
 MODLOGSEARCH=true
 MODLOGDOWNLOAD=true
+LOGREPORTOPTS=''
 
 . settings
 export GROUP ABBREV INFOHEADER MODEMAIL GROUPURL REJECTIONSLIST
-export DIVERTPOSTINGS MODLOGSEARCH MODLOGDOWNLOAD
+export DIVERTPOSTINGS MODLOGSEARCH MODLOGDOWNLOAD LOGREPORTOPTS
 
 . ../global-settings
 export ROOTBASEDIR CGIBASEURL DOMAIN SLIMYDOMAIN OURUSER ADMIN
index 3a41cb5656d19a1a5e9cfa3f8736e9bb6db7cb41..965d816430f2b04f9b5b2707aff56df1ec3f622a 100644 (file)
@@ -25,6 +25,7 @@ sub process_approval_decision {
                "Subject: $Subject\n" .
                 "Organization: http://www.algebra.com/~ichudov/stump\n";
 
+  $message .= "\n# $cathow\n";
   $message .= "\n$decision\n";
   $message .= "comment $comment\n" if $comment;
   &email_message( $message, $address );
index 2e9bc7003ebfcb810df69bfc3f6700bdb2f3381f..916be1282e640c8755d4f9bb6b03fddecbb2e28a 100755 (executable)
@@ -8,12 +8,20 @@ our %f;
 
 my $publish_rejections_patfile= '/dev/null';
 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;
+
+for (;;) {
+    last unless @ARGV;
+    last unless $ARGV[0] =~ m/^-/;
+    $_ = shift @ARGV;
+    last if m/^--?$/;
+    while (m/^-./) {
+       if (s/^-P(.*)$//) {
+           $publish_rejections= 1;
+           $publish_rejections_patfile= $1 if length $1;
+       } else {
+           die "bad option $_ ?";
+       }
+    }
 }
 
 our ($how) = @_;
@@ -88,10 +96,14 @@ sub parse_webstump2stump () {
        parse__stumpsubject();
        last if m/^$/;
     }
+    my $cathow = '';
     while (<STDIN>) {
        chomp;
+       if (m/^\#( \w+.*)$/) {
+           $cathow = $1;
+       }
        next unless m/^reject|^approve|^preapprove/;
-       $f{Event}= $_;
+       $f{Event}= $_.$cathow;
        last;
     }
 }
index aef8458c91932a5d164a0d25ca146a7823fa989d..92a6a5e2793004467b195b4976a09f8cd3bc35d9 100755 (executable)
@@ -1,13 +1,34 @@
 #!/usr/bin/perl -w
 
-our ($ng,$staticfiles,@ARGV) = @ARGV;
-chdir $ng or die $!;
-
 use strict (qw(vars));
 use IO::Handle;
 use POSIX;
 use CGI qw/:standard *table end_* -no_xhtml/;
 
+our $timesquash = 3;
+# no. of digits at end of time to replace with x, 0..4
+our %reasonshow = qw(approve 1 reject 1);
+# no. of words to show
+
+for (;;) {
+    last unless @ARGV;
+    last unless $ARGV[0] =~ m/^-/;
+    $_ = shift @ARGV;
+    last if m/^--?$/;
+    while (m/^-./) {
+       if (s/^-t([0-4])/-/) {
+           $timesquash= $1;
+       } elsif (s/^-r(\w+)=(\d)$//) {
+           $reasonshow{$1}= $2;
+       } else {
+           die "bad option $_ ?";
+       }
+    }
+}
+
+our ($ng,$staticfiles,@ARGV) = @ARGV;
+chdir $ng or die $!;
+
 our @lines= ();
 our @s;
 our $oddeven = "o";
@@ -22,8 +43,11 @@ sub processlog ($$) {
        chomp;
        @s= split /\t/;
        push @s, '' if @s<=6;
-        $s[0]= strftime "%Y-%m-%d %H:%M %Z", localtime $s[0];
-        $s[0] =~ s/(\d+\:\d)\d/${1}x/;
+        $s[0]= strftime "%Y-%m-%d %H:%M:%S %Z", localtime $s[0];
+       for (my $i=0; $i<$timesquash; $i++) {
+           $s[0] =~ s/(\d\d:[\d:]*)\d/$1x/;
+        }
+       $s[0] =~ s/:xx / /;
        &$processline();
        $oddeven =~ y/oe/eo/;
     }
@@ -55,6 +79,14 @@ sub processline_print () {
        $sp[5]= a({ href=>"$staticfiles/nr-$s[6].txt" }, $sp[5] );
     }
 
+    if ($sp[5] =~ m/^\w+\b/ &&
+       defined (my $reasonshow= $reasonshow{$&})) {
+       my @reas= split /\s+/, $sp[5];
+       $reasonshow--;
+       $#reas = $reasonshow if $#reas > $reasonshow;
+       $sp[5] = join ' ', @reas;
+    }
+
     print "<tr class='$oddeven'><td>$sp[0]</td>";
     print "<td class='ref'>$sp[1] $sp[2]</td>";
     print td([@sp[3..5]]),"</tr>\n";