summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-20 21:51:14 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-20 21:51:14 +0800
commit9c94a379cb7b1d079553e175539eb7473d2f438e (patch)
tree07fa794de707869a0d49ffe25b52dfeea0fc80d4
parent8aac813144a26bd5a9e6f89c9e470fff36404183 (diff)
downloadpttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.tar
pttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.tar.gz
pttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.tar.bz2
pttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.tar.lz
pttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.tar.xz
pttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.tar.zst
pttbbs-9c94a379cb7b1d079553e175539eb7473d2f438e.zip
added vote board limits for BM using key 'C'
fixed no mail alert when replying to board and mail git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2342 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--include/pttstruct.h4
-rw-r--r--mbbsd/bbs.c5
-rw-r--r--mbbsd/voteboard.c64
4 files changed, 72 insertions, 2 deletions
diff --git a/include/proto.h b/include/proto.h
index a28e33ff..5f085190 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -667,6 +667,7 @@ int vice_main(void);
/* voteboard */
int do_voteboard(int);
void do_voteboardreply(fileheader_t *fhdr);
+int do_votelimitedit(int ent, fileheader_t * fhdr, char *direct);
/* xyz */
int m_sysop(void);
diff --git a/include/pttstruct.h b/include/pttstruct.h
index a0c8e140..19c53727 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -165,7 +165,9 @@ typedef struct boardheader_t {
char BM[IDLEN * 3 + 3]; /* BMs' userid, token '/' */
unsigned int brdattr; /* board妮┦ */
char chesscountry;
- char pad[3]; /* ⊿ノ */
+ unsigned char limit_posts; /* 硈竝 : ゅ彻絞计 */
+ unsigned char limit_logins; /* 硈竝 : 祅Ω计 */
+ char pad[1]; /* ⊿ノ */
time_t bupdate; /* note update time */
char pad2[3]; /* ⊿ノ */
unsigned char bvote; /* タ羭快 Vote 计 */
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 3c1a8906..26c5852e 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -4,6 +4,7 @@
#define WHEREAMI_LEVEL 16
static int recommend(int ent, fileheader_t * fhdr, char *direct);
+int mailalert(char *userid);
#ifdef ASSESS
static char * const badpost_reason[] = {
@@ -733,6 +734,8 @@ do_general(int isbid)
sethomedir(genbuf, quote_user);
if (append_record(genbuf, &postfile, sizeof(postfile)) == -1)
msg = err_uid;
+ else
+ mailalert(quote_user);
}
outs(msg);
curredit ^= EDIT_BOTH;
@@ -2417,7 +2420,7 @@ const onekey_t read_comms[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, // 'A' 65
bh_title_edit, // 'B'
- NULL, // 'C'
+ do_votelimitedit, // 'C'
del_range, // 'D'
edit_post, // 'E'
NULL, // 'F'
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index 341f6911..852b297b 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -2,6 +2,59 @@
#include "bbs.h"
#define VOTEBOARD "NewBoard"
+int
+do_votelimitedit(int ent, fileheader_t * fhdr, char *direct)
+{
+ char genbuf[256];
+ int temp;
+ boardheader_t *bp = NULL;
+
+ if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)))
+ return DONOTHING;
+ bp = getbcache(currbid);
+ getdata(23, 0, "э (A)セ絞 (B)セ箇砞硈竝 (C)[C]", genbuf, 3, LCECHO);
+ if (genbuf[0] == 'a' || genbuf[0] == 'A') {
+ sprintf(genbuf, "%u", ((fhdr->money >> 8) & 0xF) * 10);
+ do {
+ getdata_buf(23, 0, "Ω计 (0~2550)", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ temp /= 10;
+ fhdr->money = (fhdr->money & ~(0xF0)) | (temp << 8);
+
+ sprintf(genbuf, "%u", (fhdr->money & 0xF) * 10);
+ do {
+ getdata_buf(23, 0, "ゅ彻絞计 (0~2550)", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ temp /= 10;
+ fhdr->money = (fhdr->money & ~(0xF)) | temp;
+ substitute_ref_record(direct, fhdr, ent);
+ vmsg("эЧΘ");
+ return FULLUPDATE;
+ }
+ else if (genbuf[0] == 'b' || genbuf[0] == 'B') {
+ sprintf(genbuf, "%u", bp->limit_logins * 10);
+ do {
+ getdata_buf(23, 0, "Ω计 (0~2550)", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ bp->limit_logins = (unsigned char)(temp / 10);
+
+ sprintf(genbuf, "%u", bp->limit_posts * 10);
+ do {
+ getdata_buf(23, 0, "ゅ彻絞计 (0~2550)", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ bp->limit_posts = (unsigned char)(temp / 10);
+ substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
+ log_usies("SetBoard", bp->brdname);
+ vmsg("эЧΘ");
+ return FULLUPDATE;
+ }
+ vmsg("э");
+ return FULLUPDATE;
+}
void
do_voteboardreply(fileheader_t * fhdr)
@@ -25,6 +78,12 @@ do_voteboardreply(fileheader_t * fhdr)
vmsg("癸ぃ癬眤ヘ玡礚猭祇ゅ彻");
return;
}
+ len = fhdr->money;
+ if ( cuser.numlogins < (((len >> 8) & 0xF) * 10) || cuser.numposts < ((len & 0xF) * 10) ) {
+ move(5, 10);
+ vmsg("计/ゅ彻计ぃì翅");
+ return;
+ }
setbpath(fpath, currboard);
stampfile(fpath, &votefile);
@@ -331,6 +390,11 @@ do_voteboard(int type)
strlcpy(votefile.owner, cuser.userid, sizeof(votefile.owner));
strlcpy(votefile.title, title, sizeof(votefile.title));
votefile.filemode |= FILE_VOTE;
+ temp = getbnum(currboard);
+ /* use lower 16 bits of 'money' to store limits */
+ /* lower 8 bits are logins, higher 8 bits are posts */
+ votefile.money = ( ((unsigned int)(bcache[temp - 1].limit_logins) << 8) |
+ (unsigned int)(bcache[temp - 1].limit_posts) );
setbdir(genbuf, currboard);
if (append_record(genbuf, &votefile, sizeof(votefile)) != -1)
setbtotal(currbid);