diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-01-04 01:36:57 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-01-04 01:36:57 +0800 |
commit | defbdb6544e58ade4316af4a2e003568d34aa6a1 (patch) | |
tree | bc81167a8805590feaf2c65961a8ef2ad4994c93 | |
parent | 5166f31cd61af5481f3a418e761368e643230f38 (diff) | |
download | pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.tar pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.tar.gz pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.tar.bz2 pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.tar.lz pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.tar.xz pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.tar.zst pttbbs-defbdb6544e58ade4316af4a2e003568d34aa6a1.zip |
1. add "cancel bad post" feature.
2. fix bad the bug that user won't get bad post when he is online.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3260 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 1 | ||||
-rw-r--r-- | include/pttstruct.h | 13 | ||||
-rw-r--r-- | mbbsd/bbs.c | 1 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 4 | ||||
-rw-r--r-- | mbbsd/menu.c | 1 | ||||
-rw-r--r-- | mbbsd/passwd.c | 10 | ||||
-rw-r--r-- | mbbsd/user.c | 40 |
7 files changed, 61 insertions, 9 deletions
diff --git a/include/proto.h b/include/proto.h index a4e8dbf2..6faa25de 100644 --- a/include/proto.h +++ b/include/proto.h @@ -715,6 +715,7 @@ int u_editcalendar(void); void user_display(const userec_t *u, int real); void uinfo_query(userec_t *u, int real, int unum); int showsignature(char *fname, int *j, SigInfo *psi); +int u_cancelbadpost(); void kick_all(char *user); void violate_law(userec_t * u, int unum); void mail_violatelaw(const char* crime, const char* police, const char* reason, const char* result); diff --git a/include/pttstruct.h b/include/pttstruct.h index 78882529..362f3dd0 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -108,7 +108,8 @@ typedef struct userec_t { char myangel[IDLEN+1]; /* 我的小天使 */ unsigned short chess_elo_rating; /* 象棋等級分 */ unsigned int withme; /* 我想找人下棋,聊天.... */ - char pad[34]; + time4_t timeremovebadpost; /* 上次刪除劣文時間 */ + char pad[30]; } userec_t; /* these are flags in userec_t.uflag */ #define PAGER_FLAG 0x4 /* true if pager was OFF last session */ @@ -331,10 +332,11 @@ typedef struct msgque_t { int msgmode; } msgque_t; -#define ALERT_NEW_MAIL 1 +#define ALERT_NEW_MAIL 1 #define ISNEWMAIL(utmp) utmp->alerts & ALERT_NEW_MAIL -#define ALERT_RELOAD_PERM 2 - +#define ALERT_PWD_PERM 2 +#define ALERT_PWD_BADPOST 4 +#define ALERT_PWD (ALERT_PWD_PERM|ALERT_PWD_BADPOST) /* user data in shm */ /* use GAP to detect and avoid data overflow and overriding */ typedef struct userinfo_t { @@ -349,10 +351,13 @@ typedef struct userinfo_t { char from[27]; /* machine name the user called in from */ int from_alias; char sex; + char nonuse[4]; + /* unsigned char goodpost; unsigned char badpost; unsigned char goodsale; unsigned char badsale; + */ unsigned char angel; /* friends */ diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index a3254707..965eb0fd 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2483,6 +2483,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) xuser.userlevel |= PERM_VIOLATELAW; passwd_update(tusernum, &xuser); } + sendalert(userid, ALERT_PWD_BADPOST); mail_id(userid, genbuf, newpath, cuser.userid); #ifdef BAD_POST_RECORD diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index c31d4d12..5fbebeef 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -159,10 +159,12 @@ u_exit(const char *mode) return; reload_money(); + /* cuser.goodpost = currutmp->goodpost; cuser.badpost = currutmp->badpost; cuser.goodsale = currutmp->goodsale; cuser.badsale = currutmp->badsale; + */ auto_backup(); setflags(PAGER_FLAG, currutmp->pager != PAGER_ON); @@ -857,10 +859,12 @@ setup_utmp(int mode) uinfo.chess_elo_rating = cuser.chess_elo_rating; uinfo.invisible = cuser.invisible % 2; uinfo.pager = cuser.pager % PAGER_MODES; + /* uinfo.goodpost = cuser.goodpost; uinfo.badpost = cuser.badpost; uinfo.goodsale = cuser.goodsale; uinfo.badsale = cuser.badsale; + */ if(cuser.withme & (cuser.withme<<1) & (WITHME_ALLFLAG<<1)) cuser.withme = 0; uinfo.withme = cuser.withme; diff --git a/mbbsd/menu.c b/mbbsd/menu.c index e91e1dce..d6215215 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -474,6 +474,7 @@ static const commands_t userlist[] = { {u_cloak, PERM_CLOAK, "KKCloak 隱身術"}, #endif {u_register, PERM_BASIC, "RRegister 填寫《註冊申請單》"}, + {u_cancelbadpost, PERM_LOGINOK, "CCancelBadPost 申請刪除劣文"}, {u_list, PERM_SYSOP, "XUsers 列出註冊名單"}, #ifdef MERGEBBS // {m_sob, PERM_LOGUSER|PERM_SYSOP, "SSOB Import 沙灘變身術"}, diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c index ba7e4580..f5f03ca5 100644 --- a/mbbsd/passwd.c +++ b/mbbsd/passwd.c @@ -76,12 +76,16 @@ passwd_update(int num, userec_t * buf) if (num < 1 || num > MAX_USERS) return -1; buf->money = moneyof(num); - if(usernum ==num && (currutmp->alerts & ALERT_RELOAD_PERM)) + pwdfd = currutmp->alerts; + if(usernum == num && (pwdfd & ALERT_PWD)) { userec_t u; passwd_query(num, &u); - cuser.userlevel = buf->userlevel = u.userlevel; - currutmp->alerts &= ~ALERT_RELOAD_PERM; + if(pwdfd & ALERT_PWD_BADPOST) + cuser.badpost = buf->badpost = u.badpost; + if(pwdfd & ALERT_PWD_PERM) + cuser.userlevel = buf->userlevel = u.userlevel; + currutmp->alerts &= ~ALERT_PWD; } if ((pwdfd = open(fn_passwd, O_WRONLY)) < 0) exit(1); diff --git a/mbbsd/user.c b/mbbsd/user.c index 00c92ed4..a96138c5 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -66,6 +66,42 @@ u_loginview(void) } return 0; } +int u_cancelbadpost(void) +{ + int day; + if(cuser.badpost==0) + {vmsg("你並沒有劣文."); return 0;} + + if(search_ulistn(usernum,2)) + {vmsg("請登出其他視窗, 否則不受理."); return 0;} + + passwd_query(usernum, &cuser); + day = (cuser.timeremovebadpost - now) / 86400 + 180; + if(day>0 && day<=180) + { + vmsgf("每 180 天才能申請一次, 還剩 %d 天.", day); + vmsg("您也可以注意站方是否有勞動服務方式刪除劣文."); + return 0; + } + + if( + getkey("我願意尊守站方規定,組規,以及板規[y/N]?")!='y' || + getkey("我願意尊重不歧視族群,不鬧板,尊重各板主權力[y/N]?")!='y' || + getkey("我願意謹慎發表有意義言論,不謾罵攻擊,不跨板廣告[y/N]?")!='y' ) + + {vmsg("請您思考清楚後再來申請刪除."); return 0;} + + if(search_ulistn(usernum,2)) + {vmsg("請登出其他視窗, 否則不受理."); return 0;} + if(cuser.badpost) + { + cuser.badpost--; + cuser.timeremovebadpost = now; + passwd_update(usernum, &cuser); + } + vmsg("恭喜您已經成功刪除一篇劣文."); + return 0; +} void user_display(const userec_t * u, int adminmode) @@ -187,7 +223,7 @@ mail_violatelaw(const char *crime, const char *police, const char *reason, const fileheader_t fhdr; FILE *fp; - sendalert(crime, ALERT_RELOAD_PERM); + sendalert(crime, ALERT_PWD_PERM); sethomepath(genbuf, crime); stampfile(genbuf, &fhdr); @@ -994,7 +1030,7 @@ uinfo_query(userec_t *u, int adminmode, int unum) } passwd_update(unum, &x); if(flag) - sendalert(x.userid, ALERT_RELOAD_PERM); // force to reload perm + sendalert(x.userid, ALERT_PWD_PERM); // force to reload perm } } |