summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-08 00:53:24 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-08 00:53:24 +0800
commit3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e (patch)
treeb213d9d7c667adb9dc817be00097e451007bf426
parent968e680633cbd1da3e6d0f87f0555d0ef1d6f7bd (diff)
downloadpttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.tar
pttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.tar.gz
pttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.tar.bz2
pttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.tar.lz
pttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.tar.xz
pttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.tar.zst
pttbbs-3e6d4b2f59d6f4ba8120e9e7772932375b8f5a3e.zip
- refine limit edit source
- move M (maintain vote) to integrated board config git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3806 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c179
-rw-r--r--mbbsd/board.c46
2 files changed, 118 insertions, 107 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index de049be2..31d74a62 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1912,11 +1912,64 @@ read_post(int ent, fileheader_t * fhdr, const char *direct)
return FULLUPDATE;
}
+void
+editLimits(unsigned char *pregtime, unsigned char *plogins,
+ unsigned char *pposts, unsigned char *pbadpost)
+{
+ char genbuf[STRLEN];
+ int temp;
+
+ // load var
+ unsigned char
+ regtime = *pregtime,
+ logins = *plogins,
+ posts = *pposts,
+ badpost = *pbadpost;
+
+ // query UI
+ sprintf(genbuf, "%u", regtime);
+ do {
+ getdata_buf(b_lines - 1, 0,
+ "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 255);
+ regtime = (unsigned char)temp;
+
+ sprintf(genbuf, "%u", logins);
+ do {
+ getdata_buf(b_lines - 1, 0,
+ "上站次數下限 (0~2550):", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ logins = (unsigned char)(temp / 10);
+
+ sprintf(genbuf, "%u", posts);
+ do {
+ getdata_buf(b_lines - 1, 0,
+ "文章篇數下限 (0~2550):", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 2550);
+ posts = (unsigned char)(temp / 10);
+
+ sprintf(genbuf, "%u", 255 - badpost);
+ do {
+ getdata_buf(b_lines - 1, 0,
+ "劣文篇數上限 (0~255):", genbuf, 5, LCECHO);
+ temp = atoi(genbuf);
+ } while (temp < 0 || temp > 255);
+ badpost = (unsigned char)(255 - temp);
+
+ // save var
+ *pregtime = regtime;
+ *plogins = logins;
+ *pposts = posts;
+ *pbadpost = badpost;
+}
+
int
do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
{
- char genbuf[256], buf[256];
- int temp;
+ char buf[STRLEN];
boardheader_t *bp = getbcache(currbid);
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
@@ -1931,36 +1984,15 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
if (fhdr->filemode & FILE_VOTE)
strcat(buf, " (C)本篇");
strcat(buf, "連署限制 (Q)取消?[Q]");
- genbuf[0] = getans(buf);
-
- if ((HasUserPerm(PERM_SYSOP) || (HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())) && genbuf[0] == 'a') {
- sprintf(genbuf, "%u", bp->post_limit_regtime);
- do {
- getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 255);
- bp->post_limit_regtime = (unsigned char)temp;
-
- sprintf(genbuf, "%u", bp->post_limit_logins * 10);
- do {
- getdata_buf(b_lines - 1, 0, "上站次數下限 (0~2550):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 2550);
- bp->post_limit_logins = (unsigned char)(temp / 10);
-
- sprintf(genbuf, "%u", bp->post_limit_posts * 10);
- do {
- getdata_buf(b_lines - 1, 0, "文章篇數下限 (0~2550):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 2550);
- bp->post_limit_posts = (unsigned char)(temp / 10);
-
- sprintf(genbuf, "%u", 255 - bp->post_limit_badpost);
- do {
- getdata_buf(b_lines - 1, 0, "劣文篇數上限 (0~255):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 255);
- bp->post_limit_badpost = (unsigned char)(255 - temp);
+ buf[0] = getans(buf);
+
+ if ((HasUserPerm(PERM_SYSOP) || (HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())) && buf[0] == 'a') {
+
+ editLimits(
+ &bp->post_limit_regtime,
+ &bp->post_limit_logins,
+ &bp->post_limit_posts,
+ &bp->post_limit_badpost);
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
@@ -1968,34 +2000,13 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
vmsg("修改完成!");
return FULLUPDATE;
}
- else if (genbuf[0] == 'b') {
- sprintf(genbuf, "%u", bp->vote_limit_regtime);
- do {
- getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 255);
- bp->vote_limit_regtime = (unsigned char)temp;
-
- sprintf(genbuf, "%u", bp->vote_limit_logins * 10);
- do {
- getdata_buf(b_lines - 1, 0, "上站次數下限 (0~2550):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 2550);
- bp->vote_limit_logins = (unsigned char)(temp / 10);
-
- sprintf(genbuf, "%u", bp->vote_limit_posts * 10);
- do {
- getdata_buf(b_lines - 1, 0, "文章篇數下限 (0~2550):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 2550);
- bp->vote_limit_posts = (unsigned char)(temp / 10);
-
- sprintf(genbuf, "%u", 255 - bp->vote_limit_badpost);
- do {
- getdata_buf(b_lines - 1, 0, "劣文篇數上限 (0~255):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 255);
- bp->vote_limit_badpost = (unsigned char)(255 - temp);
+ else if (buf[0] == 'b') {
+
+ editLimits(
+ &bp->vote_limit_regtime,
+ &bp->vote_limit_logins,
+ &bp->vote_limit_posts,
+ &bp->vote_limit_badpost);
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
@@ -2003,36 +2014,13 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
vmsg("修改完成!");
return FULLUPDATE;
}
- else if ((fhdr->filemode & FILE_VOTE) && genbuf[0] == 'c') {
- sprintf(genbuf, "%u", fhdr->multi.vote_limits.regtime);
- do {
- getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 255);
- fhdr->multi.vote_limits.regtime = temp;
-
- sprintf(genbuf, "%u", (unsigned int)(fhdr->multi.vote_limits.logins) * 10);
- do {
- getdata_buf(b_lines - 1, 0, "上站次數下限 (0~2550):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 2550);
- temp /= 10;
- fhdr->multi.vote_limits.logins = (unsigned char)temp;
-
- sprintf(genbuf, "%u", (unsigned int)(fhdr->multi.vote_limits.posts) * 10);
- do {
- getdata_buf(b_lines - 1, 0, "文章篇數下限 (0~2550):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } 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, "劣文篇數上限 (0~255):", genbuf, 5, LCECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 255);
- fhdr->multi.vote_limits.badpost = (unsigned char)temp;
+ else if ((fhdr->filemode & FILE_VOTE) && buf[0] == 'c') {
+
+ editLimits(
+ &fhdr->multi.vote_limits.regtime,
+ &fhdr->multi.vote_limits.logins,
+ &fhdr->multi.vote_limits.posts,
+ &fhdr->multi.vote_limits.badpost);
substitute_ref_record(direct, fhdr, ent);
vmsg("修改完成!");
@@ -3219,7 +3207,10 @@ view_postinfo(int ent, const fileheader_t * fhdr, const char *direct, int crs_ln
char aidc[10];
aidu2aidc(aidc, aidu);
- prints(" │ 此篇文章的" AID_DISPLAYNAME "為: " ANSI_COLOR(1) "#%s" ANSI_RESET " (%s)\n", aidc, currboard && currboard[0] ? currboard : "未知");
+ prints(" │ 此篇文章的" AID_DISPLAYNAME "為: "
+ ANSI_COLOR(1) "#%s" ANSI_RESET " (%s) [%s]\n",
+ aidc, currboard && currboard[0] ? currboard : "未知",
+ MYHOSTNAME);
}
else
{
@@ -3664,7 +3655,7 @@ const onekey_t read_comms[] = {
{ 0, NULL }, // Ctrl('K')
{ 0, NULL }, // Ctrl('L')
{ 0, NULL }, // Ctrl('M')
- { 0, b_moved_to_config }, // Ctrl('N')
+ { 0, NULL }, // Ctrl('N')
{ 0, do_post_openbid }, // Ctrl('O') // BETTER NOT USE ^O - UNIX not work
{ 0, do_post }, // Ctrl('P')
{ 0, NULL }, // Ctrl('Q')
@@ -3702,7 +3693,7 @@ const onekey_t read_comms[] = {
#endif
{ 0, NULL }, // 'K'
{ 1, solve_post }, // 'L'
- { 0, b_vote_maintain }, // 'M'
+ { 0, b_moved_to_config }, // 'M'
{ 0, NULL }, // 'N'
{ 0, NULL }, // 'O'
{ 0, NULL }, // 'P'
@@ -3746,7 +3737,7 @@ const onekey_t read_comms[] = {
#else
{ 0, NULL }, // 'u'
#endif
- { 0, NULL }, // 'v'
+ { 0, b_moved_to_config }, // 'v'
{ 1, b_call_in }, // 'w'
{ 1, cross_post }, // 'x'
{ 1, reply_post }, // 'y'
diff --git a/mbbsd/board.c b/mbbsd/board.c
index a04cfa21..adbefaa1 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -292,9 +292,9 @@ b_config(void)
grayout(0, ytitle-2, GRAYOUT_DARK);
// available hotkeys yet:
- // a b d j k m p q z
- // 2 3 4 5 6 7 9 0
- // better not: l
+ // a b d j k p q z
+ // 2 3 4 5 6 7 9
+ // better not: l 0
while(!finished) {
move(ytitle-1, 0); clrtobot();
@@ -444,20 +444,34 @@ b_config(void)
);
}
- if (isBM)
{
+ const char *aCat = ANSI_COLOR(1;32);
+ const char *aHot = ANSI_COLOR(1;36);
+ const char *aRst = ANSI_RESET;
+
+ if (!isBM)
+ {
+ aCat = ANSI_COLOR(1;30;40);
+ aHot = "";
+ aRst = "";
+ }
+
ipostres ++;
move_ansi(ipostres++, COLPOSTRES-2);
- outs(ANSI_COLOR(1;32) "名單編輯與其它:" ANSI_RESET);
+ outs(aCat);
+ outs("名單編輯與其它:");
+ if (!isBM) outs(" (需板主權限)");
+ outs(aRst);
move_ansi(ipostres++, COLPOSTRES);
- outs(ANSI_COLOR(1;36) "v" ANSI_RESET ")可見名單 "
- ANSI_COLOR(1;36) "w" ANSI_RESET ")水桶名單 ");
+ prints("%sv%s)可見名單 %sw%s)水桶名單 ",
+ aHot, aRst, aHot, aRst);
move_ansi(ipostres++, COLPOSTRES);
- outs(ANSI_COLOR(1;36) "o" ANSI_RESET ")投票名單 ");
- //ANSI_COLOR(1;36) "w" ANSI_RESET ")水桶名單 ");
+ prints("%sm%s)舉辦投票 %so%s)投票名單 ",
+ aHot, aRst, aHot, aRst);
move_ansi(ipostres++, COLPOSTRES);
- outs(ANSI_COLOR(1;36) "c" ANSI_RESET ")文章類別 "
- ANSI_COLOR(1;36) "n" ANSI_RESET ")發文注意事項 ");
+ prints("%sc%s)文章類別 %sn%s)發文注意事項 ",
+ aHot, aRst, aHot, aRst);
+ outs(ANSI_RESET);
}
move(b_lines, 0);
@@ -586,14 +600,20 @@ b_config(void)
clear();
break;
+ case 'w':
+ clear();
+ friend_edit(BOARD_WATER);
+ clear();
+ break;
+
case 'o':
clear();
friend_edit(FRIEND_CANVOTE);
clear();
- case 'w':
+ case 'm':
clear();
- friend_edit(BOARD_WATER);
+ b_vote_maintain();
clear();
break;