chiark / gitweb /
add hacky LP bug notification helper
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Tue, 6 May 2008 14:16:03 +0000 (14:16 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Tue, 6 May 2008 14:16:03 +0000 (14:16 +0000)
lp-bug-notify-helper [new file with mode: 0755]

diff --git a/lp-bug-notify-helper b/lp-bug-notify-helper
new file mode 100755 (executable)
index 0000000..578afb9
--- /dev/null
@@ -0,0 +1,23 @@
+#! /bin/sh
+set -e
+
+formail -cz -X Subject: -X X-Launchpad-Bug: | \
+       perl -nle '
+               s/\s+/ /g;
+               if (s/^Subject:\s+//i) {
+                       s/^\[Bug (\d+)\] \[NEW\] // or exit 0;
+                       $bug = $1;
+                       $subj = $_;
+               } elsif (s/^X-Launchpad-Bug:\s+//i) {
+                       if (/\bimportance=(\w+)/) {
+                               $imp = $1;
+                       }
+               }
+               END {
+                       if (defined $bug and defined $subj) {
+                               $imp = "Undecided" unless defined $imp;
+                               open FILE, ">>$ENV{HOME}/.irssi/fnotify";
+                               print FILE "LPBUG $bug $imp $subj";
+                               close FILE;
+                       }
+               }'