[Qa-jenkins-scm] [jenkins.debian.net] 01/01: email2irc: fix multi-line (rfc822-folded) subjects, fix lines with backslashes, add TODO

Holger Levsen holger at layer-acht.org
Sun Nov 13 12:09:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 9fad4ef32e58be5552f9754de45579683fe9dc2f
Author: Daniel Shahaf <danielsh at apache.org>
Date:   Sun Nov 13 12:07:22 2016 +0000

    email2irc: fix multi-line (rfc822-folded) subjects, fix lines with backslashes, add TODO
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/email2irc.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/bin/email2irc.sh b/bin/email2irc.sh
index 20c0a96..5909b50 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list