# HG changeset patch # User HIROSE Yuuji # Date 1486696956 -32373 # Node ID e30fe590a53e41ed087a27a9013b2d02fe402dac # Parent c1b4a9dba1c9458fff95b753f6572a94fd9b739d Allow replymark in other than the first line. diff -r c1b4a9dba1c9 -r e30fe590a53e s4-blog.sh --- a/s4-blog.sh Fri Feb 10 11:41:44 2017 +0859 +++ b/s4-blog.sh Fri Feb 10 12:22:09 2017 +0859 @@ -29,12 +29,13 @@ } blog_notify_reply() ( # $1=blogid $2=ReplyingUser $3=WrittenText $4(optional)=Action - blogowner=`getvalbyid blog owner "$1"` + blogid="${1%%[!A-Z0-9a-z_]*}" + blogowner=`getvalbyid blog owner "$blogid"` [ x"$2" = x"$blogowner" ] && return # If author=blogowner, unnecessary - blogtitle=`getvalbyid blog title "$1"` - blogurl="$urlbase?replyblog+$1" + blogtitle=`getvalbyid blog title "$blogid"` + blogurl="$urlbase?replyblog+$blogid" action=${4:-書き込み} - mode=`getvalbyid blog notify "$1"` + mode=`getvalbyid blog notify "$blogid"` ### EXCEPT=`sqlquote "$user"` ## User should receive to feal some annoyance case $mode in admin) @@ -50,25 +51,27 @@ ;; no) emails="" ;; *) team=`query "SELECT val FROM blog_s - WHERE id=(SELECT id FROM blog WHERE rowid=$1) + WHERE id=(SELECT id FROM blog WHERE rowid=$blogid) AND key='team';"` - # team cannot get `getvalbyid blog team "$1"` because it's not + # team cannot get `getvalbyid blog team "$blogid"` because it's not # defined in blog.def. Yes, it is Illegal USE!! emails=`TEAM=$team collectemail $blogowner` ;; esac ## 2017-0210 Respond to the direct reply mark such as: >#1234 - replymark=`echo "$3"|head -1|nkf -Z0|grep '^ *>#'` + replymark=`echo "$3"|nkf -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 "$replymark"|sed 's/[^#0-9]*#\([0-9]*\)[^#0-9]*/\1 /g'` ids=`echo $ids|tr ' ' ','` - # -> 123 345 347 + # -> 123,345,347 unames=`query "SELECT distinct author FROM article \ WHERE rowid in ($ids)\ - AND bloid=(SELECT id FROM blog WHERE rowid=$blogid;"` - emails=$emails" `email4group \"$blogowner\" $unames`" - action="あなたへの返信" + AND blogid=(SELECT id FROM blog WHERE rowid=$blogid);"` + if [ -n "$unames" ]; then + emails=$emails" `email4group \"$blogowner\" $unames`" + action="あなたへの返信" + fi fi test -z "$emails" && return err notify: user=$user Admins=`getgroupadmins $blogowner` Mode=$mode Emails="[$emails]" diff -r c1b4a9dba1c9 -r e30fe590a53e s4-funcs.sh --- a/s4-funcs.sh Fri Feb 10 11:41:44 2017 +0859 +++ b/s4-funcs.sh Fri Feb 10 12:22:09 2017 +0859 @@ -1026,7 +1026,7 @@ # $SMAIL_TO <- Recipient value of To: header # $MAIL_FROM <- From: header value from=`echo "${MAIL_FROM:-$admin}"|nkf -jM|tr -d '\n'` - rcpt=`echo $1` # strip newlines + rcpt=`echo $1|tr ' ' '\n'|sort -u|tr '\n' ' '` # uniq and strip newlines subj=`echo $2|nkf -jM|tr -d '\n'` (_m4 -D_RCPT_="${SMAIL_TO:-$rcpt}" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4 cat $3 | nkf -jd ) | sendmail -f $admin $rcpt