diff options
-rw-r--r-- | pttbbs/include/proto.h | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/assess.c | 63 | ||||
-rw-r--r-- | pttbbs/mbbsd/user.c | 25 |
3 files changed, 76 insertions, 13 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index 8c51d051..9e5b26df 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -63,6 +63,7 @@ int edit_user_acl_for_board(const char *uid, const char *board); int inc_badpost(const char *, int num); int bad_comment(const char *fn); int assign_badpost(const char *userid, fileheader_t *fhdr, const char *newpath, const char *comment); +int reassign_badpost(const char *userid); /* bbs */ int is_file_owner(const fileheader_t *, const userec_t*); diff --git a/pttbbs/mbbsd/assess.c b/pttbbs/mbbsd/assess.c index be1633d6..13eee806 100644 --- a/pttbbs/mbbsd/assess.c +++ b/pttbbs/mbbsd/assess.c @@ -153,6 +153,69 @@ int assign_badpost(const char *userid, fileheader_t *fhdr, return 0; } +int +reassign_badpost(const char *userid) { + // 劣退復鞭屍,補劣何其多。補劣無通知,用戶搞不懂。 + // 用戶若被補劣累,東牽西扯罵系統。 + // + // 所以,如果真的要補劣,一定要告知使用者。 + userec_t u; + char title[TTLEN+1]; + char msg[512]; + char buf[10]; + char reason[50]; + int orig_badpost = 0; + int uid; + + vs_hdr2(" 劣文修正 ", userid); + if ((uid = getuser(userid, &u)) == 0) { + vmsgf("找不到使用者 %s。", userid); + return -1; + } + orig_badpost = u.badpost; + prints("\n使用者 %s 的劣文數目前為: %d\n", userid, u.badpost); + snprintf(buf, sizeof(buf), "%d", u.badpost); + if (!getdata_str(5, 0, "調整劣文數目為: ", buf, sizeof(buf), DOECHO, buf) || + atoi(buf) == u.badpost) { + vmsg("劣文數目不變,未變動。"); + return 0; + } + + // something changed. + u.badpost = atoi(buf); + prints("\n使用者 %s 的劣文即將由 %d 改為 %d。請輸入理由(會寄給使用者)\n", + userid, orig_badpost, u.badpost); + if (!getdata(7, 0, "理由: ", reason, sizeof(reason), DOECHO)) { + vmsg("錯誤: 不能無理由。"); + return -1; + } + + move(6, 0); clrtobot(); + prints("使用者 %s 的劣文由 %d 改為 %d。\n理由: %s\n", + userid, orig_badpost, u.badpost, reason); + if (!getdata(9, 0, "確定? [y/N]", buf, 3, LCECHO) || buf[0] != 'y') { + vmsg("錯誤: 未確定,放棄。"); + return -1; + } + + // GOGOGO + snprintf(msg, sizeof(msg), + " 站長" ANSI_COLOR(1;32) "%s" ANSI_RESET "把" ANSI_COLOR(1;32) + "%s" ANSI_RESET "的劣文從" ANSI_COLOR(1;35) "%d" ANSI_RESET + "改成" ANSI_COLOR(1;35) "%d" ANSI_RESET "\n" + " " ANSI_COLOR(1;37) "修改理由是:%s" ANSI_RESET, + cuser.userid, u.userid, orig_badpost, u.badpost, reason); + snprintf(title, sizeof(title), + "[公安報告] 站長%s修改%s劣文報告", cuser.userid, u.userid); + post_msg(BN_SECURITY, title, msg, "[系統安全局]"); + mail_log2id_text(u.userid, "[系統通知] 劣文變更", msg, + "[系統安全局]", NA); + passwd_sync_update(uid, &u); + kick_all(u.userid); + + return 0; +} + // XXX 推文目前的設計一整個就是無法管理, // 不過在重寫整套短文回應系統前也是沒辦法的事, // 先寫個應應急 diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c index d30b60d1..1ad25e01 100644 --- a/pttbbs/mbbsd/user.c +++ b/pttbbs/mbbsd/user.c @@ -633,8 +633,8 @@ uinfo_query(const char *orig_uid, int adminmode, int unum) } ans = vans(adminmode ? - "(1)改資料(2)密碼(3)權限(4)砍帳號(5)改ID(6)寵物(7)審判(M)信箱 [0]結束 " : - "請選擇 (1)修改資料 (2)設定密碼 (C)個人化設定 ==> [0]結束 "); + "(1)改資料(2)密碼(3)權限(4)砍帳(5)改ID(6)寵物(7)審判(8)劣文(M)信箱 [0]結束 " : + "請選擇 (1)修改資料 (2)設定密碼 (C)個人化設定 [0]結束 "); if (ans > '2' && ans != 'c' && !adminmode) ans = '0'; @@ -647,7 +647,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum) outs(x.userid); } - if (adminmode && ((ans >= '1' && ans <= '7') || ans == 'm') && + if (adminmode && ((ans >= '1' && ans <= '8') || ans == 'm') && search_ulist(unum)) { if (vans("使用者目前正在線上,修改資料會先踢下線。確定要繼續嗎? (y/N): ") @@ -723,9 +723,6 @@ uinfo_query(const char *orig_uid, int adminmode, int unum) } break; - case '7': - violate_law(&x, unum); - return; case '1': move(0, 0); outs("請逐項修改。"); @@ -907,14 +904,8 @@ uinfo_query(const char *orig_uid, int adminmode, int unum) if (getdata_str(y++, 0, "文章數目:", buf, 10, DOECHO, genbuf)) if ((tmp = atoi(buf)) >= 0) x.numposts = tmp; -#ifdef ASSESS - snprintf(genbuf, sizeof(genbuf), "%d", x.badpost); - if (getdata_str(y, 0, "惡劣文章數:", buf, 10, DOECHO, genbuf)) - if ((tmp = atoi(buf)) >= 0) - x.badpost = tmp; -#endif // ASSESS move(y-1, 0); clrtobot(); - prints("文章數目: %d (劣: %d)\n", + prints("文章數目: %d (劣: %d, 修改劣文請改用選項8)\n", x.numposts, x.badpost); snprintf(genbuf, sizeof(genbuf), "%d", x.vl_count); @@ -1176,6 +1167,14 @@ uinfo_query(const char *orig_uid, int adminmode, int unum) chicken_toggle_death(x.userid); break; + case '7': + violate_law(&x, unum); + return; + + case '8': + reassign_badpost(x.userid); + return; + default: return; } |