# HG changeset patch # User HIROSE Yuuji # Date 1607481277 -32400 # Node ID 85a20c87bf974b90a3061b57031b65607ca23d16 # Parent 0905a624c720ebc474d1b4e3ce1334c2cc836c78 Use the "## "heading in the first as Subject of notification email. diff -r 0905a624c720 -r 85a20c87bf97 s4-blog.sh --- a/s4-blog.sh Tue Dec 08 12:24:19 2020 +0900 +++ b/s4-blog.sh Wed Dec 09 11:34:37 2020 +0900 @@ -66,38 +66,46 @@ ## 2017-0210 Respond to the direct reply mark such as: >#1234 replymark=`echo "$3"|nkf -w -Z0|grep '^ *>#'` authgecos=`gecos $2` - if [ -z "$4" -a -n "$replymark" ]; then - # If the action is new subscription($4="") and has ">#123" marks... - ids=`echo "$replymark"|sed 's/[^#0-9]*#\([0-9]*\)[^#0-9]*/\1 /g'` - ids=`echo $ids|tr -dc '[0-9 ]'|tr ' ' ','` - # -> 123,345,347 - unames=`query "SELECT distinct author FROM article \ + ## 2020-1209 If the first line begins with '## ', use it as Subject + firstline=`echo "$3"|head -1|nkf -w -Z0` + if [ -z "$4" ]; then + if [ -n "$replymark" ]; then + # If the action is new subscription($4="") and has ">#123" marks... + ids=`echo "$replymark"|sed 's/[^#0-9]*#\([0-9]*\)[^#0-9]*/\1 /g'` + ids=`echo $ids|tr -dc '[0-9 ]'|tr ' ' ','` + # -> 123,345,347 + unames=`query "SELECT distinct author FROM article \ WHERE rowid in ($ids)\ AND blogid=(SELECT id FROM blog WHERE rowid=$blogid);"` - if [ -n "$unames" ]; then - e4g=$(if $_isgroup; then - email4group "$blogowner" $unames - else - for u in $unames; do - collectemail $u - done - fi) - emails=$emails" $e4g" - for e in $unames; do - g=`gecos $e` - whom=$whom"${whom:+,}${g:-$e}さん" - done - action="${whom}への返信" + if [ -n "$unames" ]; then + e4g=$(if $_isgroup; then + email4group "$blogowner" $unames + else + for u in $unames; do + collectemail $u + done + fi) + emails=$emails" $e4g" + for e in $unames; do + g=`gecos $e` + whom=$whom"${whom:+,}${g:-$e}さん" + done + action="${whom}への返信" + fi + elif echo "$firstline" | grep -q "^## "; then + subject=${firstline#\#\# } fi else + # This else block is not symmetry, check later(2020-1209) [ x"$2" = x"$blogowner" ] && return # If author=blogowner, unnecessary fi test -z "$emails" && return + sj=${subject:-${action}通知} err notify: user=$user Admins=`getgroupadmins "$blogowner"` Mode=$mode Emails="[$emails]" quotedowner=`echo $blogowner | nkf -jM | tr -d '\n"'` MAIL_FROM=$noreply_from \ SMAIL_TO="\"$quotedowner\" readers <$noreply>" \ - smail "$emails" "${action}通知 $urlbase"<$help

}" filehelp="《添付の注意》 $file_accept_help" - ntmode="通知モード=$blog_notify${blog_team:+ (team=$blog_team)}" + ntmode="通知モード=$blog_notify${blog_team:+ (team=$blog_team)} +記事の1行目を「## 」(半角シャープシャープ空白=大見出し) +にするとそれがSubject(件名)になります。 +If the first line begins with "## ", sent it as Subject of email." textform=$(cat<<-EOF