summaryrefslogtreecommitdiffstats
path: root/mbbsd/bbs.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-14 01:13:33 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-14 01:13:33 +0800
commit9bb2b461450f6b953032aac4e57238cdff4e296a (patch)
treed102bbf927737bf989f5916c7c26f3d178734a1c /mbbsd/bbs.c
parent05dd93de8f37b2fcb2c7ed26c0cb18e550678494 (diff)
downloadpttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.tar
pttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.tar.gz
pttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.tar.bz2
pttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.tar.lz
pttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.tar.xz
pttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.tar.zst
pttbbs-9bb2b461450f6b953032aac4e57238cdff4e296a.zip
* put-back the code to handle numlogin (changed to numlogindays)
* we can enable this after current code base becomes stable git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4838 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/bbs.c')
-rw-r--r--mbbsd/bbs.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 04a726ca..ae216a02 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -346,10 +346,15 @@ CheckPostPerm(void)
// check if my own permission is changed.
if (ISNEWPERM(currutmp))
{
- // XXX let pwcuReload handle NEWPERM?
- CLEAR_ALERT_NEWPERM(currutmp);
+#ifdef DEBUG
+ log_filef("log/newperm.log", LOG_CREAT,
+ "%-13s: reloaded perm %s\n",
+ cuser.userid, Cdate(&now));
+#endif
currmode &= ~MODE_POSTCHECKED;
pwcuReload();
+ // XXX let pwcuReload handle NEWPERM?
+ CLEAR_ALERT_NEWPERM(currutmp);
}
if (currmode & MODE_POSTCHECKED)
@@ -405,6 +410,10 @@ int CheckPostRestriction(int bid)
// check first-login
if (cuser.firstlogin > (now - (time4_t)bp->post_limit_regtime * MONTH_SECONDS))
return 0;
+#ifdef USE_LOGIN_LIMITS
+ if (cuser.numlogindays / 10 < (unsigned int)bp->post_limit_logins)
+ return 0;
+#endif
// XXX numposts itself is an integer, but some records (by del post!?) may
// create invalid records as -1... so we'd better make it signed for real
// comparison.
@@ -939,7 +948,6 @@ do_general(int garbage)
return READ_REDRAW;
}
-#ifndef DEBUG
if ( !CheckPostRestriction(currbid) )
{
vmsg("你不夠資深喔! (可按 i 查看限制)");
@@ -949,7 +957,6 @@ do_general(int garbage)
if(check_cooldown(bp))
return READ_REDRAW;
#endif
-#endif
clear();
setbfile(genbuf, currboard, FN_POST_NOTE);
@@ -1978,7 +1985,8 @@ read_post(int ent, fileheader_t * fhdr, const char *direct)
}
void
-editLimits(unsigned char *pregtime, unsigned char *pposts, unsigned char *pbadpost)
+editLimits(unsigned char *pregtime, unsigned char *plogins,
+ unsigned char *pposts, unsigned char *pbadpost)
{
char genbuf[STRLEN];
int temp;
@@ -1986,6 +1994,7 @@ editLimits(unsigned char *pregtime, unsigned char *pposts, unsigned char *pbadpo
// load var
unsigned char
regtime = *pregtime,
+ logins = *plogins,
posts = *pposts,
badpost = *pbadpost;
@@ -1998,6 +2007,17 @@ editLimits(unsigned char *pregtime, unsigned char *pposts, unsigned char *pbadpo
} while (temp < 0 || temp > 255);
regtime = (unsigned char)temp;
+#ifdef USE_LOGIN_LIMITS
+ sprintf(genbuf, "%u", logins*10);
+ do {
+ move(b_lines-1, 0); clrtoeol(); // because previous prompt has same BIG5 prefix here
+ getdata_buf(b_lines - 1, 0,
+ STR_LOGINDAYS "下限 (0~2550,以10為單位,個位數字將自動捨去):", genbuf, 5, NUMECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ logins = (unsigned char)(temp / 10);
+#endif
+
sprintf(genbuf, "%u", posts*10);
do {
getdata_buf(b_lines - 1, 0,
@@ -2016,6 +2036,7 @@ editLimits(unsigned char *pregtime, unsigned char *pposts, unsigned char *pbadpo
// save var
*pregtime = regtime;
+ *plogins = logins;
*pposts = posts;
*pbadpost = badpost;
}
@@ -2044,6 +2065,7 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
editLimits(
&bp->post_limit_regtime,
+ &bp->post_limit_logins,
&bp->post_limit_posts,
&bp->post_limit_badpost);
@@ -2057,6 +2079,7 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
editLimits(
&bp->vote_limit_regtime,
+ &bp->vote_limit_logins,
&bp->vote_limit_posts,
&bp->vote_limit_badpost);
@@ -2070,6 +2093,7 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
editLimits(
&fhdr->multi.vote_limits.regtime,
+ &fhdr->multi.vote_limits.logins,
&fhdr->multi.vote_limits.posts,
&fhdr->multi.vote_limits.badpost);