chiark / gitweb /
stump: fix hideous bug where passlisting someone puts their whole From: line in the...
[modbot-mtm.git] / stump / bin / processApproved
index 615d0c17ccee00bd12715f9409c20f9fcdfcb51e..a62333ecd60c78160bccb07f5c239c2ebe745ee3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -e
+set -ex
 set -o pipefail
 
 NEWSBIN=/var/lib/newsbin; export NEWSBIN
@@ -31,7 +31,12 @@ post() {
   (
     echo Path: "$PATH_SUFFIX"
 
-    cat $MNG_ROOT/etc/added-headers | grep ': ' 
+    perl <$MNG_ROOT/etc/added-headers -ne '
+        next unless m/\:/;
+        s/\[REFERENCE\]/[$ENV{"WEBSTUMP_MESSAGENUM"}]/g
+            if defined $ENV{"WEBSTUMP_MESSAGENUM"};
+        print or die $!;
+    '
     # I do grep above because a lot of users inserts empty
     # lines in the added headers.