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 wrap: on
line diff
--- a/s4-blog.sh	Thu Feb 09 20:13:58 2017 +0859
+++ b/s4-blog.sh	Fri Feb 10 11:41:44 2017 +0859
@@ -48,7 +48,7 @@
 	emails=$emails" `email4groupbyuid \"$blogowner\" $notifyto`"
       fi
 	;;
-    no)		return ;;
+    no)		emails="" ;;
     *) team=`query "SELECT val FROM blog_s
 		    WHERE id=(SELECT id FROM blog WHERE rowid=$1)
 			   AND key='team';"`
@@ -56,13 +56,29 @@
        # 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 '^ *>#'`
+  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 ' ' ','`
+    # -> 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="あなたへの返信"
+  fi
+  test -z "$emails" && return
   err notify: user=$user Admins=`getgroupadmins $blogowner` Mode=$mode Emails="[$emails]"
   SMAIL_TO="`echo "$blogowner" | nkf -jM | tr -d '\n'` readers <$admin>" \
 	  smail "$emails" "${action}通知 $urlbase"<<EOF
 [$blogtitle]板に${action}がありました。
 場所: $blogurl
+所有: $blogowner
 題目: $blogtitle
-筆者: `gecos $2`
+筆者: $authgecos
 内容:
 `echo "$3"|sed 's/^/> /'`
 EOF

yatex.org