summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Graham <joseph@fibreglass.tunachunks>2013-08-29 12:49:01 +0100
committerJoseph Graham <joseph@fibreglass.tunachunks>2013-08-29 12:49:01 +0100
commitdb67faeb01d9a1a52c503a9809e3fb9100a8ea0a (patch)
treec95fa367b26a378c10969925a8691c44837af372
parent283edb2f629f20dd4df974025e3e92467295755b (diff)
Made a script to watch for emails to find out when a bug has changed
-rw-r--r--labs_change_detector31
1 files changed, 31 insertions, 0 deletions
diff --git a/labs_change_detector b/labs_change_detector
new file mode 100644
index 0000000..375bb4c
--- /dev/null
+++ b/labs_change_detector
@@ -0,0 +1,31 @@
+#! /bin/bash
+
+bot_ipc="/tmp/un-provoked-message-store"
+
+shopt -s extglob
+
+next_line_is_url=0
+
+inotifywait -m --format '%w%f' -e create ~/Maildir/new 2>/dev/null |
+while read email
+do
+ while read line
+ do
+ case "${line}" in
+ 'Issue #'* )
+ echo -n "${line}"
+ ;;
+ 'Bug #'+([[:digit:]])': '* )
+ echo -n " (${line#'Bug #'+([[:digit:]])': '})"
+ next_line_is_url=1
+ ;;
+ ' https://labs.parabola.nu/issues/'* )
+ (( next_line_is_url )) &&
+ echo -n "${line}"
+ break
+ ;;
+ esac
+ done < "${email}"
+
+ echo
+done #>> "${bot_ipc}"