]> git.g-eek.se Git - users/gustav/scripts.git/commitdiff
[event-participant] Make quoted tolerant
authorGustav Eek <gustav.eek@fripost.org>
Sun, 1 Nov 2020 18:37:27 +0000 (19:37 +0100)
committerGustav Eek <gustav.eek@fripost.org>
Sun, 1 Nov 2020 18:37:27 +0000 (19:37 +0100)
For names which are encoded as Quoted-Printable, decode those using
qprint(1).

event-participant

index fccdd42ad697cedc6db468b73ca53547f052d7b8..497a65f460afcadd73b1d97e9d24a278be5d7c42 100755 (executable)
@@ -46,7 +46,14 @@ fi
 info=$(cat | grep "^From:\|^Date:" | tr '\n' ':')
 
 [[ "$info" =~ (From: )([^:]*) ]]
-participant="${BASH_REMATCH[2]}"
+match="${BASH_REMATCH[2]}"
+if [[ ${match:0:1} == "=" ]]; then
+    name=$(echo ${match% <*} | sed 's/^=?.*?\(.*\)?=$/\1/' | qprint -d)
+    email="<${match#* <}"
+    participant="$name $email"
+else
+    participant="$match"
+fi
 [[ "$info" =~ (Date: )([^:]*) ]]
 date=$(date -I -d "${BASH_REMATCH[2]}")