summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-07-25 23:17:18 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-07-25 23:17:18 +0800
commite8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde (patch)
tree1ba549a3702ad232a795c1527ef73fdf274eebe5
parent540472d231db4088e050b32737dee45f3ed07235 (diff)
downloadpttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.tar
pttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.tar.gz
pttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.tar.bz2
pttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.tar.lz
pttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.tar.xz
pttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.tar.zst
pttbbs-e8b7db8875e3cba60b0ec8742b0cb7cc63c0bbde.zip
add badposts as post/vote limit
show post limits on board config git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3386 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/pttstruct.h6
-rw-r--r--mbbsd/bbs.c40
-rw-r--r--mbbsd/mail.c1
-rw-r--r--mbbsd/voteboard.c8
4 files changed, 51 insertions, 4 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 6ee1d3ee..c2eb86b5 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -199,7 +199,9 @@ typedef struct boardheader_t {
char posttype[33];
char posttype_f;
unsigned char fastrecommend_pause; /* �ֳt�s�����j */
- char pad3[49];
+ unsigned char vote_limit_badpost; /* �s�p : �H��W�� */
+ unsigned char post_limit_badpost; /* �o���峹 : �H��W�� */
+ char pad3[47];
} boardheader_t;
/* �U���O�K�i��� */
@@ -263,7 +265,7 @@ typedef struct fileheader_t {
unsigned char posts;
unsigned char logins;
unsigned char regtime;
- unsigned char pad[1];
+ unsigned char badpost;
} vote_limits;
struct {
/* is this ordering correct? */
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 961074bd..6f8ecbe4 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -698,6 +698,7 @@ do_general(int isbid)
#ifndef DEBUG
if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) &&
(cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(bcache[currbid - 1].post_limit_badpost)) ||
cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) ||
cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10)) ) {
move(5, 10);
@@ -985,6 +986,7 @@ do_generalboardreply(/*const*/ fileheader_t * fhdr)
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) &&
(cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(bcache[currbid - 1].post_limit_badpost)) ||
cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) ||
cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10)) ) {
getdata(b_lines - 1, 0, "�� �^���� (M)�@�̫H�c (Q)�����H[M] ",
@@ -1345,6 +1347,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) &&
(cuser.firstlogin > (now - (time4_t)bcache[author - 1].post_limit_regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(bcache[currbid - 1].post_limit_badpost)) ||
cuser.numlogins < ((unsigned int)(bcache[author - 1].post_limit_logins) * 10) ||
cuser.numposts < ((unsigned int)(bcache[author - 1].post_limit_posts) * 10)) ) {
vmsg("�A������`��I");
@@ -1591,6 +1594,14 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
temp = atoi(genbuf);
} while (temp < 0 || temp > 2550);
bp->post_limit_posts = (unsigned char)(temp / 10);
+
+ sprintf(genbuf, "%u", bp->post_limit_badpost);
+ do {
+ getdata_buf(b_lines - 1, 0, "�H��g�ƤW�� (0~255)�G", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 255);
+ bp->post_limit_badpost = (unsigned char)temp;
+
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
log_usies("SetBoard", bp->brdname);
@@ -1618,6 +1629,14 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
temp = atoi(genbuf);
} while (temp < 0 || temp > 2550);
bp->vote_limit_posts = (unsigned char)(temp / 10);
+
+ sprintf(genbuf, "%u", bp->vote_limit_badpost);
+ do {
+ getdata_buf(b_lines - 1, 0, "�H��g�ƤW�� (0~255)�G", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 255);
+ bp->vote_limit_badpost = (unsigned char)temp;
+
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
log_usies("SetBoard", bp->brdname);
@@ -1647,6 +1666,14 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
} while (temp < 0 || temp > 2550);
temp /= 10;
fhdr->multi.vote_limits.posts = (unsigned char)temp;
+
+ sprintf(genbuf, "%u", (unsigned int)(fhdr->multi.vote_limits.badpost));
+ do {
+ getdata_buf(b_lines - 1, 0, "�H��g�ƤW�� (0~255)�G", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 255);
+ fhdr->multi.vote_limits.badpost = (unsigned char)temp;
+
substitute_ref_record(direct, fhdr, ent);
vmsg("�ק粒���I");
return FULLUPDATE;
@@ -2181,6 +2208,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
#ifndef DEBUG
if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) &&
(cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(bcache[currbid - 1].post_limit_badpost)) ||
cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) ||
cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10)) ) {
move(5, 10);
@@ -3073,6 +3101,18 @@ b_config(void)
" �^��",
(bp->brdattr & BRD_NOREPLY) ? "���i�H" : "�i�H" );
+ move(b_lines - 10, 56);
+ prints("�o�孭��");
+ move(b_lines - 9, 58);
+ prints("�W������ %d ���H�W", (int)bp->post_limit_logins * 10);
+ move(b_lines - 8, 58);
+ prints("�峹�g�� %d �g�H�W", (int)bp->post_limit_posts * 10);
+ move(b_lines - 7, 58);
+ prints("���U�ɶ� %d �Ӥ�H�W", (int)bp->post_limit_regtime);
+ move(b_lines - 6, 58);
+ prints("�H��g�� %d �g�H�U", (int)bp->post_limit_badpost);
+ move(b_lines, 0);
+
if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)))
{
vmsg("�z�惡�O�L�޲z�v��");
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 52b03cbb..1fca15ee 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1291,6 +1291,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, const char *direct)
assert(0<=ent-1 && ent-1<MAX_BOARD);
if ( !(HasUserPerm(PERM_SYSOP)) &&
(cuser.firstlogin > (now - (time4_t)bcache[ent - 1].post_limit_regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(bcache[ent - 1].post_limit_badpost)) ||
cuser.numlogins < ((unsigned int)(bcache[ent - 1].post_limit_logins) * 10) ||
cuser.numposts < ((unsigned int)(bcache[ent - 1].post_limit_posts) * 10)) ) {
move(5, 10);
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index b85253aa..6a79a46a 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -24,10 +24,12 @@ do_voteboardreply(const fileheader_t * fhdr)
vmsg("�藍�_�A�z�ثe�L�k�b���o���峹�I");
return;
}
- if ( cuser.numlogins < ((unsigned int)(fhdr->multi.vote_limits.logins) * 10) ||
+ if (cuser.firstlogin > (now - (time4_t)fhdr->multi.vote_limits.regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(fhdr->multi.vote_limits.badpost)) ||
+ cuser.numlogins < ((unsigned int)(fhdr->multi.vote_limits.logins) * 10) ||
cuser.numposts < ((unsigned int)(fhdr->multi.vote_limits.posts) * 10) ) {
move(5, 10);
- vmsg("�A���W����/�峹�Ƥ�����I");
+ vmsg("�A������`��I");
return;
}
setbpath(fpath, currboard);
@@ -166,6 +168,7 @@ do_voteboard(int type)
return FULLUPDATE;
}
if ( cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].vote_limit_regtime * 2592000) ||
+ cuser.badpost > ((unsigned int)(bcache[currbid - 1].vote_limit_badpost)) ||
cuser.numlogins < ((unsigned int)(bcache[currbid - 1].vote_limit_logins) * 10) ||
cuser.numposts < ((unsigned int)(bcache[currbid - 1].vote_limit_posts) * 10) ) {
move(5, 10);
@@ -350,6 +353,7 @@ do_voteboard(int type)
votefile.multi.vote_limits.regtime = bcache[currbid - 1].vote_limit_regtime;
votefile.multi.vote_limits.logins = bcache[currbid - 1].vote_limit_logins;
votefile.multi.vote_limits.posts = bcache[currbid - 1].vote_limit_posts;
+ votefile.multi.vote_limits.badpost = bcache[currbid - 1].vote_limit_badpost;
setbdir(genbuf, currboard);
if (append_record(genbuf, &votefile, sizeof(votefile)) != -1)
setbtotal(currbid);