summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-01-04 01:36:57 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-01-04 01:36:57 +0800
commitdefbdb6544e58ade4316af4a2e003568d34aa6a1 (patch)
treebc81167a8805590feaf2c65961a8ef2ad4994c93 /mbbsd
parent5166f31cd61af5481f3a418e761368e643230f38 (diff)
downloadpttbbs-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
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c1
-rw-r--r--mbbsd/mbbsd.c4
-rw-r--r--mbbsd/menu.c1
-rw-r--r--mbbsd/passwd.c10
-rw-r--r--mbbsd/user.c40
5 files changed, 51 insertions, 5 deletions
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
}
}