From 46e9fa78b7a1f2b6368c8b6cb3c7c0f0f6909b48 Mon Sep 17 00:00:00 2001 From: ptt Date: Tue, 15 Nov 2005 15:57:25 +0000 Subject: add restriction to PERM_VIOLATELAW no chat no write no plan file git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3238 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/proto.h | 4 +++- mbbsd/chat.c | 6 ++++++ mbbsd/talk.c | 4 ++-- mbbsd/user.c | 29 ++++++++++++++++++++--------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/include/proto.h b/include/proto.h index 92c9716d..8500fa98 100644 --- a/include/proto.h +++ b/include/proto.h @@ -716,9 +716,11 @@ 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); 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); -void showplans(const char *uid); int u_info(void); +void showplans(const char *uid); +void showplans_userec(userec_t *u); int u_loginview(void); int u_ansi(void); int u_editplan(void); diff --git a/mbbsd/chat.c b/mbbsd/chat.c index 917f8c8d..fc8507d1 100644 --- a/mbbsd/chat.c +++ b/mbbsd/chat.c @@ -318,6 +318,12 @@ t_chat(void) char fpath[80]; struct ChatBuf chatbuf; + if(HasUserPerm(PERM_VIOLATELAW)) + { + vmsg("請先繳罰單才能使用聊天室!"); + return -1; + } + memset(&chatbuf, 0, sizeof(chatbuf)); outs(" 驅車前往 請梢候........ "); diff --git a/mbbsd/talk.c b/mbbsd/talk.c index d6f0dbc6..af9aad56 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -52,7 +52,7 @@ iswritable_stat(const userinfo_t * uentp, int fri_stat) if (HasUserPerm(PERM_SYSOP)) return 1; - if (!HasUserPerm(PERM_LOGINOK)) + if (!HasUserPerm(PERM_LOGINOK) || HasUserPerm(PERM_VIOLATELAW)) return 0; return (uentp->pager != PAGER_ANTIWB && @@ -471,7 +471,7 @@ my_query(const char *uident) if ((uentp && ((fri_stat & HFM) || strcmp(muser.userid,cuser.userid) == 0) && !uentp->invisible)) prints("《 性 別 》%-28.28s\n", sex[muser.sex % 8]); - showplans(muser.userid); + showplans_userec(&muser); if(HasUserPerm(PERM_SYSOP|PERM_POLICE) ) { if(vmsg("T: 開立罰單")=='T') diff --git a/mbbsd/user.c b/mbbsd/user.c index f9a407bc..0b6c7b37 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -1012,15 +1012,20 @@ u_cloak(void) } void -showplans(const char *uid) +showplans_userec(userec_t *user) { char genbuf[200]; + if(user->userlevel & PERM_VIOLATELAW) + { + outs("此人違規 尚未繳交罰單"); + return; + } + #ifdef CHESSCOUNTRY if (user_query_mode) { int i = 0; FILE *fp; - userec_t xuser; sethomefile(genbuf, uid, chess_photo_name[user_query_mode - 1]); if ((fp = fopen(genbuf, "r")) != NULL) @@ -1043,13 +1048,12 @@ showplans(const char *uid) i++; } - getuser(uid, &xuser); if (user_query_mode == 1) { - win = xuser.five_win; - lost = xuser.five_lose; + win = user->five_win; + lost = user->five_lose; } else if(user_query_mode == 2) { - win = xuser.chc_win; - lost = xuser.chc_lose; + win = user->chc_win; + lost = user->chc_lose; } prints("%s <總共戰績> %d 勝 %d 敗\n", photo[5], win, lost); @@ -1063,11 +1067,18 @@ showplans(const char *uid) } #endif /* defined(CHESSCOUNTRY) */ - sethomefile(genbuf, uid, fn_plans); + sethomefile(genbuf, user->userid, fn_plans); if (!show_file(genbuf, 7, MAX_QUERYLINES, ONLY_COLOR)) - prints("《個人名片》%s 目前沒有名片", uid); + prints("《個人名片》%s 目前沒有名片", user->userid); } +void +showplans(const char *uid) +{ + userec_t user; + if(getuser(uid, &user)) + showplans_userec(&user); +} /* * return value: how many items displayed */ int -- cgit v1.2.3