From 719b39ec2c97fb3900924c03514e039513e9a3ff Mon Sep 17 00:00:00 2001
From: piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>
Date: Tue, 10 Apr 2012 02:49:28 +0000
Subject: Ban email automatically when killing userid.

git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5616 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
---
 pttbbs/mbbsd/user.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c
index e9deb626..5f51b6ea 100644
--- a/pttbbs/mbbsd/user.c
+++ b/pttbbs/mbbsd/user.c
@@ -12,6 +12,20 @@ static const char * const chess_type[3] = {
 };
 #endif
 
+void
+ban_usermail(const userec_t *u, const char *reason) {
+    assert(u);
+    if (!(u->userlevel & PERM_LOGINOK))
+        return;
+    if (!strchr(u->email, '@'))
+        return;
+    if (!reason || !*reason)
+        reason = "(�����ѤF��)";
+    log_filef("etc/banemail", LOG_CREAT,
+              "# %s: %s (by %s)\nA%s\n",
+              u->userid, reason, cuser.userid, u->email);
+}
+
 int
 kill_user(int num, const char *userid)
 {
@@ -394,6 +408,7 @@ violate_law(userec_t * u, int unum)
 
         kick_all(u->userid);
 	delete_allpost(u->userid);
+        ban_usermail(u, reason);
         kill_user(unum, u->userid);
 	post_violatelaw(u->userid, cuser.userid, reason, "�尣 ID");
     } else {
-- 
cgit v1.2.3