s4

changeset 410:c1b4a9dba1c9

Direct reply notification fired by ">#NNN" in the first line
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 10 Feb 2017 11:41:44 +0859
parents 388639a80a23
children e30fe590a53e
files s4-blog.sh
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/s4-blog.sh	Thu Feb 09 20:13:58 2017 +0859
     1.2 +++ b/s4-blog.sh	Fri Feb 10 11:41:44 2017 +0859
     1.3 @@ -48,7 +48,7 @@
     1.4  	emails=$emails" `email4groupbyuid \"$blogowner\" $notifyto`"
     1.5        fi
     1.6  	;;
     1.7 -    no)		return ;;
     1.8 +    no)		emails="" ;;
     1.9      *) team=`query "SELECT val FROM blog_s
    1.10  		    WHERE id=(SELECT id FROM blog WHERE rowid=$1)
    1.11  			   AND key='team';"`
    1.12 @@ -56,13 +56,29 @@
    1.13         # defined in blog.def.  Yes, it is Illegal USE!!
    1.14         emails=`TEAM=$team collectemail $blogowner` ;;
    1.15    esac
    1.16 +  ## 2017-0210 Respond to the direct reply mark such as: >#1234
    1.17 +  replymark=`echo "$3"|head -1|nkf -Z0|grep '^ *>#'`
    1.18 +  authgecos=`gecos $2`
    1.19 +  if [ -z "$4" -a -n "$replymark"  ]; then
    1.20 +    # If the action is new subscription($4="") and has ">#123" marks...
    1.21 +    ids=`echo "$replymark"|sed 's/[^#0-9]*#\([0-9]*\).[^#0-9]*/\1 /g'`
    1.22 +    ids=`echo $ids|tr ' ' ','`
    1.23 +    # -> 123 345 347
    1.24 +    unames=`query "SELECT distinct author FROM article \
    1.25 +	WHERE rowid in ($ids)\
    1.26 +	AND bloid=(SELECT id FROM blog WHERE rowid=$blogid;"`
    1.27 +    emails=$emails" `email4group \"$blogowner\" $unames`"
    1.28 +    action="あなたへの返信"
    1.29 +  fi
    1.30 +  test -z "$emails" && return
    1.31    err notify: user=$user Admins=`getgroupadmins $blogowner` Mode=$mode Emails="[$emails]"
    1.32    SMAIL_TO="`echo "$blogowner" | nkf -jM | tr -d '\n'` readers <$admin>" \
    1.33  	  smail "$emails" "${action}通知 $urlbase"<<EOF
    1.34  [$blogtitle]板に${action}がありました。
    1.35  場所: $blogurl
    1.36 +所有: $blogowner
    1.37  題目: $blogtitle
    1.38 -筆者: `gecos $2`
    1.39 +筆者: $authgecos
    1.40  内容:
    1.41  `echo "$3"|sed 's/^/> /'`
    1.42  EOF