X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fnew_card.sh;fp=cards%2Fnew_card.sh;h=0273a2cb44ac481c2c6f7554e3e3782a855be3a0;hp=1e37b7001af3c84a86d25409cdc8e81bc3e272ed;hb=5d52b5c71310d367a240991e6d3ce82fa1c742ab;hpb=9ca7b43d1885bb8328e5a5e78ac6bc038d6efbb6 diff --git a/cards/new_card.sh b/cards/new_card.sh index 1e37b70..0273a2c 100755 --- a/cards/new_card.sh +++ b/cards/new_card.sh @@ -39,6 +39,14 @@ IFS='|' read -r date fn ln bmonth byear tel tcell junk1 email junk2 note <<-EOF [ ${#byear} = 2 ] && byear="20$byear" [ ${#bmonth} = 1 ] && bmonth="0$bmonth" +mn="" +case $fn in + *\ *) + mn="${fn#* }" + fn="${fn%% *}" + ;; +esac + mkdir -p "${_DATA}/lock/vcard/" lockdir="${_DATA}/lock/vcard/${card}/" lockfile=${lockdir}/${SESSION_ID} @@ -47,13 +55,13 @@ if mkdir "$lockdir"; then cat >"$lockfile" <<-EOF BEGIN:VCARD VERSION:4.0 - N:$(vcf_escape "$ln");$(vcf_escape "$fn");;; - FN:$(vcf_escape "$fn $ln") - BDAY:$(vcf_escape "${byear}-${bmonth}-01") + N:$(vcf_escape "$ln" "$fn" "$mn" "" "") + FN:$(vcf_escape "${fn}${mn:+ }${mn} ${ln}") + BDAY:$(parse_date "${byear}-${bmonth}-01") TEL:$(vcf_escape "$tel") TEL;TYPE=CELL:$(vcf_escape "$tcell") EMAIL:$(vcf_escape "$email") - X-ZACK-JOINDATE:$(vcf_escape "$date") + X-ZACK-JOINDATE:$(parse_date "$date") ADR: NOTE:$(vcf_escape "$note") UID:${uid}