s4
changeset 411:e30fe590a53e
Allow replymark in other than the first line.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 10 Feb 2017 12:22:09 +0859 |
parents | c1b4a9dba1c9 |
children | a765ed027dbd |
files | s4-blog.sh s4-funcs.sh |
diffstat | 2 files changed, 16 insertions(+), 13 deletions(-) [+] |
line diff
1.1 --- a/s4-blog.sh Fri Feb 10 11:41:44 2017 +0859 1.2 +++ b/s4-blog.sh Fri Feb 10 12:22:09 2017 +0859 1.3 @@ -29,12 +29,13 @@ 1.4 } 1.5 blog_notify_reply() ( 1.6 # $1=blogid $2=ReplyingUser $3=WrittenText $4(optional)=Action 1.7 - blogowner=`getvalbyid blog owner "$1"` 1.8 + blogid="${1%%[!A-Z0-9a-z_]*}" 1.9 + blogowner=`getvalbyid blog owner "$blogid"` 1.10 [ x"$2" = x"$blogowner" ] && return # If author=blogowner, unnecessary 1.11 - blogtitle=`getvalbyid blog title "$1"` 1.12 - blogurl="$urlbase?replyblog+$1" 1.13 + blogtitle=`getvalbyid blog title "$blogid"` 1.14 + blogurl="$urlbase?replyblog+$blogid" 1.15 action=${4:-書き込み} 1.16 - mode=`getvalbyid blog notify "$1"` 1.17 + mode=`getvalbyid blog notify "$blogid"` 1.18 ### EXCEPT=`sqlquote "$user"` ## User should receive to feal some annoyance 1.19 case $mode in 1.20 admin) 1.21 @@ -50,25 +51,27 @@ 1.22 ;; 1.23 no) emails="" ;; 1.24 *) team=`query "SELECT val FROM blog_s 1.25 - WHERE id=(SELECT id FROM blog WHERE rowid=$1) 1.26 + WHERE id=(SELECT id FROM blog WHERE rowid=$blogid) 1.27 AND key='team';"` 1.28 - # team cannot get `getvalbyid blog team "$1"` because it's not 1.29 + # team cannot get `getvalbyid blog team "$blogid"` because it's not 1.30 # defined in blog.def. Yes, it is Illegal USE!! 1.31 emails=`TEAM=$team collectemail $blogowner` ;; 1.32 esac 1.33 ## 2017-0210 Respond to the direct reply mark such as: >#1234 1.34 - replymark=`echo "$3"|head -1|nkf -Z0|grep '^ *>#'` 1.35 + replymark=`echo "$3"|nkf -Z0|grep '^ *>#'` 1.36 authgecos=`gecos $2` 1.37 if [ -z "$4" -a -n "$replymark" ]; then 1.38 # If the action is new subscription($4="") and has ">#123" marks... 1.39 - ids=`echo "$replymark"|sed 's/[^#0-9]*#\([0-9]*\).[^#0-9]*/\1 /g'` 1.40 + ids=`echo "$replymark"|sed 's/[^#0-9]*#\([0-9]*\)[^#0-9]*/\1 /g'` 1.41 ids=`echo $ids|tr ' ' ','` 1.42 - # -> 123 345 347 1.43 + # -> 123,345,347 1.44 unames=`query "SELECT distinct author FROM article \ 1.45 WHERE rowid in ($ids)\ 1.46 - AND bloid=(SELECT id FROM blog WHERE rowid=$blogid;"` 1.47 - emails=$emails" `email4group \"$blogowner\" $unames`" 1.48 - action="あなたへの返信" 1.49 + AND blogid=(SELECT id FROM blog WHERE rowid=$blogid);"` 1.50 + if [ -n "$unames" ]; then 1.51 + emails=$emails" `email4group \"$blogowner\" $unames`" 1.52 + action="あなたへの返信" 1.53 + fi 1.54 fi 1.55 test -z "$emails" && return 1.56 err notify: user=$user Admins=`getgroupadmins $blogowner` Mode=$mode Emails="[$emails]"
2.1 --- a/s4-funcs.sh Fri Feb 10 11:41:44 2017 +0859 2.2 +++ b/s4-funcs.sh Fri Feb 10 12:22:09 2017 +0859 2.3 @@ -1026,7 +1026,7 @@ 2.4 # $SMAIL_TO <- Recipient value of To: header 2.5 # $MAIL_FROM <- From: header value 2.6 from=`echo "${MAIL_FROM:-$admin}"|nkf -jM|tr -d '\n'` 2.7 - rcpt=`echo $1` # strip newlines 2.8 + rcpt=`echo $1|tr ' ' '\n'|sort -u|tr '\n' ' '` # uniq and strip newlines 2.9 subj=`echo $2|nkf -jM|tr -d '\n'` 2.10 (_m4 -D_RCPT_="${SMAIL_TO:-$rcpt}" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4 2.11 cat $3 | nkf -jd ) | sendmail -f $admin $rcpt