summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2016-11-13 12:07:22 +0000
committerHolger Levsen <holger@layer-acht.org>2016-11-13 12:09:01 +0000
commit9fad4ef32e58be5552f9754de45579683fe9dc2f (patch)
tree38016e98714526492a7adc73da4dbc772ed58dca /bin
parentf49a6eddcecce940b9abe48da741eafe649551b5 (diff)
downloadjenkins.debian.net-9fad4ef32e58be5552f9754de45579683fe9dc2f.tar.xz
email2irc: fix multi-line (rfc822-folded) subjects, fix lines with backslashes, add TODO
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/email2irc.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/email2irc.sh b/bin/email2irc.sh
index 20c0a966..5909b509 100755
--- a/bin/email2irc.sh
+++ b/bin/email2irc.sh
@@ -23,7 +23,7 @@ DEBUG=false
HEADER=true
VALID_MAIL=false
MY_LINE=""
-while read line ; do
+while read -r line ; do
if [ "$HEADER" = "true" ] ; then
# check if email header ends
if [[ $line =~ ^$ ]] ; then
@@ -37,9 +37,9 @@ while read line ; do
if [[ $line =~ ^(Subject: .*) ]] ; then
SUBJECT=${line:9}
# the email-ext plugin sometimes sends multi line subjects..
- NEXT=read line
- if [ "${NEXT:0:1}" = " " ] ; then
- SUBJECT="${SUBJECT}${NEXT}"
+ read -r NEXT
+ if [ "${NEXT:0:1}" = " " ] || [ "${NEXT:0:1}" = $'\t' ]; then
+ SUBJECT="${SUBJECT}${NEXT:1}"
fi
fi
# determine the channel to send notifications to
@@ -67,6 +67,9 @@ while read line ; do
MY_LINE=$(echo $line | tr -d \< | tr -d \> | cut -d " " -f1-2)
debug123 "#4" MY_LINE $MY_LINE
fi
+ # TODO: deal with quoted-printable continuation lines:
+ # if $MY_LINE ends with '=', then append the next line to $MY_LINE,
+ # changing the '=' to a single space.
fi
done
# check that it's a valid job