From: Gustav Eek Date: Sun, 1 Nov 2020 18:37:27 +0000 (+0100) Subject: [event-participant] Make quoted tolerant X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=7cf68375cea52338324c0ddba74bfb5322b7d45b;p=users%2Fgustav%2Fscripts.git [event-participant] Make quoted tolerant For names which are encoded as Quoted-Printable, decode those using qprint(1). --- diff --git a/event-participant b/event-participant index fccdd42..497a65f 100755 --- a/event-participant +++ b/event-participant @@ -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]}")