diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-08-31 09:40:09 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-08-31 09:40:09 +0800 |
commit | e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1 (patch) | |
tree | 108cdc3954462507a353c8cea7a713f1697a4caa /mbbsd | |
parent | c63dc5430871a83c6aca0e1342c693dce7d8e6db (diff) | |
download | pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.tar pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.tar.gz pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.tar.bz2 pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.tar.lz pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.tar.xz pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.tar.zst pttbbs-e52b78c90c2dd62fdae8a8c538d6fa7f4eb259c1.zip |
* add 'validate namelist by badpost', suggested by VOT1077@ptt.cc(PttSuggest)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4803 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/friend.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/mbbsd/friend.c b/mbbsd/friend.c index ea565325..aa2ad319 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -234,7 +234,7 @@ delete_friend_from_file(const char *file, const char *string, int case_sensitiv #define MAX_EXPIRE_MONTH (800) int -friend_validate(int type, int expire) +friend_validate(int type, int expire, int badpost) { FILE *fp = NULL, *nfp = NULL; char fpath[PATHLEN]; @@ -247,6 +247,8 @@ friend_validate(int type, int expire) expire *= DAY_SECONDS *30; else expire = 0; + if (badpost < 0 || badpost > UCHAR_MAX) + badpost = 0; syncnow(); setfriendfile(fpath, type); @@ -271,17 +273,25 @@ friend_validate(int type, int expire) if (searchuser(buf, NULL)) { - if (expire > 0) { + if (expire > 0 || badpost > 0) { userec_t *pu = &u; // drop user if (now-lastlogin) longer than expire*month getuser(buf, &u); - // XXX lastlogin was NOT counting people with PERM_HIDE... - // although we will have 'lastseen' in future, - // never count people with PERM_HIDE. - if (!(PERM_HIDE(pu)) && - now - u.lastlogin > expire) - continue; + if (expire > 0) + { + // XXX lastlogin was NOT counting people with PERM_HIDE... + // although we will have 'lastseen' in future, + // never count people with PERM_HIDE. + if (!(PERM_HIDE(pu)) && + now - u.lastlogin > expire) + continue; + } + if (badpost > 0) + { + if (u.badpost >= badpost) + continue; + } } fputs(genbuf, nfp); } @@ -491,9 +501,8 @@ friend_edit(int type) } getdata(1, 0, (count ? "(A)增加(D)刪除(E)修改(P)引入(L)列出(K)清空" - ANSI_COLOR(33) "(C)整理有效名單" ANSI_RESET - "(W)水球(Q)結束?[Q] " : - "(A)增加 (P)引入其他名單 (Q)結束?[Q] "), + "(C)整理有效名單(W)水球(Q)結束?[Q] " : + "(A)增加 (P)引入其他名單 (Q)結束?[Q] "), uident, 3, LCECHO); if (uident[0] == 'a') { move(1, 0); @@ -503,11 +512,21 @@ friend_edit(int type) dirty = 1; } } else if (uident[0] == 'c') { + int expire, badpost; getdata(2, 0, - "要從名單中清除幾個月沒上站(包含帳號已消失)的使用者?", + "要從名單中清除幾個月沒上站(包含帳號已消失)的使用者? (0=不清除)[0] ", uident, 4, NUMECHO); + expire = atoi(uident); + if (HasUserPerm(PERM_BM | PERM_SYSOP)) + { + getdata(3, 0, + "要從名單中清除有幾篇以上劣文的使用者? (0=不清除)[0] ", + uident, 4, NUMECHO); + } + badpost = atoi(uident); + // delete all users that not in list. - friend_validate(type, atoi(uident)); + friend_validate(type, expire, badpost); dirty = 1; } else if (uident[0] == 'p') { friend_append(type, count); |