aboutsummaryrefslogtreecommitdiffstats
path: root/issues_change_detector
diff options
context:
space:
mode:
authorMárcio Silva <coadde at hyperbola dot info>2017-06-02 15:48:13 -0300
committerMárcio Silva <coadde at hyperbola dot info>2017-06-02 17:12:07 -0300
commitae928016bf637b26326ec335b10898c6c2b0e4b9 (patch)
tree98fa3a0180c9eba01d3b9082373e7a402c3f632e /issues_change_detector
parentb4830e97ae51396ccaa9ca2acb469aef80094ae8 (diff)
downloadhyperbot-ae928016bf637b26326ec335b10898c6c2b0e4b9.tar.lz
hyperbot-ae928016bf637b26326ec335b10898c6c2b0e4b9.tar.xz
hyperbot-ae928016bf637b26326ec335b10898c6c2b0e4b9.zip
Import some files from pbot-ng project and branding this project to hyperbot
Diffstat (limited to 'issues_change_detector')
-rwxr-xr-xissues_change_detector43
1 files changed, 43 insertions, 0 deletions
diff --git a/issues_change_detector b/issues_change_detector
new file mode 100755
index 0000000..50479d9
--- /dev/null
+++ b/issues_change_detector
@@ -0,0 +1,43 @@
+#! /bin/bash
+
+if ! which inotifywait &> /dev/null
+then
+ echo 'inotify is a dep. fail'
+ exit
+fi
+
+bot_ipc="/tmp/un-provoked-message-store"
+maildir="/srv/hyperbot/Maildir/new"
+
+shopt -s extglob
+
+next_line_is_url=0
+
+inotifywait -m --format '%w%f' -e create "${maildir}" 2>/dev/null |
+while read email
+do
+ while read line
+ do
+ case "${line}" in
+ 'Subject: ['* )
+ lp1="${line#Subject: [}"
+ lp="${lp1%% - *}"
+ echo -n "${lp}"
+ ;;
+ 'Issue #'* )
+ echo -n " - ${line}"
+ ;;
+ *' #'+([[:digit:]])': '* )
+ echo -n " (${line#'Bug #'+([[:digit:]])': '})"
+ next_line_is_url=1
+ ;;
+ 'https://issues.hyperbola.info/issues/'* )
+ (( next_line_is_url )) &&
+ echo -n " ${line}"
+ break
+ ;;
+ esac
+ done < "${email}"
+
+ echo
+done >> "${bot_ipc}"