diff options
-rw-r--r-- | pttbbs/include/proto.h | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/admin.c | 6 | ||||
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 20 | ||||
-rw-r--r-- | pttbbs/mbbsd/board.c | 2 |
4 files changed, 19 insertions, 10 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index f086e2bd..f6e4088c 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -89,6 +89,7 @@ int ReadSelect(void); int save_violatelaw(void); int board_select(void); int board_digest(void); +int does_board_have_public_bm(const boardheader_t *bp); int do_limitedit(int ent, fileheader_t * fhdr, const char *direct); void log_crosspost_in_allpost(const char *brd, const fileheader_t *postfile); #ifdef USE_COOLDOWN diff --git a/pttbbs/mbbsd/admin.c b/pttbbs/mbbsd/admin.c index 36b13926..a7a39313 100644 --- a/pttbbs/mbbsd/admin.c +++ b/pttbbs/mbbsd/admin.c @@ -663,6 +663,12 @@ m_mod_board(char *bname) strlcpy(newbh.title + 7, genbuf, sizeof(newbh.title) - 7); if (getdata_str(15, 0, "新板主名單:", genbuf, IDLEN * 3 + 3, DOECHO, bh.BM)) { + // TODO 照理來說在這裡 normalize 一次比較好;可惜目前似乎有奇怪的 + // 代管制度,會有人把 BM list 設定 [ ...... / some_uid],就會變成 + // 一面徵求板主同時又有人(maybe小組長)有管理權限而且還不顯示出來。 + // 這設計很糟糕,也無法判斷是不小心誤設(多了空白)或是故意的,再者 + // 還有人以為這裡打句英文很帥氣結果造成該英文的ID意外獲得權限。 + // 未來應該整個取消,完全 normalize。 trim(genbuf); strlcpy(newbh.BM, genbuf, sizeof(newbh.BM)); } diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index c857799e..4ede6932 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -341,10 +341,9 @@ set_board(void) board_note_time = &bp->bupdate; - if(bp->BM[0] <= ' ') + if (!does_board_have_public_bm(bp)) { strcpy(currBM, "徵求中"); - else - { + } else { /* calculate with other title information */ int l = 0; @@ -1204,11 +1203,14 @@ do_crosspost(const char *brd, fileheader_t *postfile, const char *fpath) } } -static int -does_board_have_any_bm(int bid) { - // in common/cache.c, BMcache uids were assigned in order, so we only need - // to check first UID. - return (SHM->BMcache[bid - 1][0] != -1); +int +does_board_have_public_bm(const boardheader_t *bp) { + // Usually we can assume SHM->BMcache contains complete BM list; however + // sometimes boards may contains only private BMs (ex: [ <-space some_uid]) + // 為了避免誤判,改成限制第一個 ID 一定要是alnum, 不然不處理 + // ex, ' something', '[something]', '中文' <= 都是不算 public BM list. + // 很糟但是還沒想到更好的作法。 + return isascii(*bp->BM) && isalnum(*bp->BM); } static int @@ -1408,7 +1410,7 @@ do_post_article() #ifdef USE_HIDDEN_BOARD_NOCREDIT (currbrdattr & BRD_HIDE) || #endif - !does_board_have_any_bm(currbid)) + !does_board_have_public_bm(bp)) { money = 0; } diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c index fe452528..be209edd 100644 --- a/pttbbs/mbbsd/board.c +++ b/pttbbs/mbbsd/board.c @@ -326,7 +326,7 @@ b_config(void) move(ytitle +2, 0); prints(" "ANSI_COLOR(1;36) "b" ANSI_RESET " - 中文敘述: %s\n", bp->title); - prints(" 板主名單: %s\n", (bp->BM[0] > ' ')? bp->BM : "(無)"); + prints(" 板主名單: %s\n", does_board_have_public_bm(bp) ? bp->BM : "(無)"); outs(" \n"); // at least one character, for move_ansi. |