summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h1
-rw-r--r--mbbsd/bbs.c28
-rw-r--r--mbbsd/cache.c3
-rw-r--r--mbbsd/var.c4
-rw-r--r--sample/etc/board.help2
5 files changed, 34 insertions, 4 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index a7df3568..bbc277dc 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -207,6 +207,7 @@ typedef struct boardheader_t {
#define BRD_SYMBOLIC 000100000 /* symbolic link to board */
#define BRD_NOBOO 000200000 /* 不可噓 */
#define BRD_LOCALSAVE 000400000 /* 預設 Local Save */
+#define BRD_RESTRICTEDPOST 001000000 /* 板友才能發文 */
#define BRD_LINK_TARGET(x) ((x)->postexpire)
#define GROUPOP() (currmode & MODE_GROUPOP)
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 5892505c..d197b1b1 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -2480,6 +2480,32 @@ change_localsave(int ent, fileheader_t * fhdr, char *direct)
return FULLUPDATE;
}
+/**
+ * 設定只有板友可 post 或全部人都可 post
+ */
+static int
+change_restrictedpost(int ent, fileheader_t * fhdr, char *direct){
+ boardheader_t *bp;
+ if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)))
+ return DONOTHING;
+
+ bp = getbcache(currbid);
+ if (bp->brdattr & BRD_RESTRICTEDPOST) {
+ if (getans("目前只有板友可 post, 要開放嗎(y/N)?") != 'y')
+ return FULLUPDATE;
+ bp->brdattr &= ~BRD_RESTRICTEDPOST;
+ outs("大家都可以 post 文章了。\n");
+ } else {
+ if (getans("目前全部人都可 post, 要限制為只有板友可 post 嗎(y/N)?") != 'y')
+ return FULLUPDATE;
+ bp->brdattr |= BRD_RESTRICTEDPOST;
+ outs("只剩板友可以 post 了。\n");
+ }
+ substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
+ pressanykey();
+ return FULLUPDATE;
+}
+
/* ----------------------------------------------------- */
/* 看板功能表 */
/* ----------------------------------------------------- */
@@ -2489,7 +2515,7 @@ const onekey_t read_comms[] = {
NULL, // Ctrl('B')
NULL, // Ctrl('C')
NULL, // Ctrl('D')
- NULL, // Ctrl('E')
+ change_restrictedpost, // Ctrl('E')
NULL, // Ctrl('F')
#ifdef NO_GAMBLE
NULL, // Ctrl('G')
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 5ac60128..1823b370 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -739,6 +739,9 @@ haspostperm(char *bname)
/* 秘密看板特別處理 */
if (bcache[i - 1].brdattr & BRD_HIDE)
return 1;
+ else if (bcache[i - 1].brdattr & BRD_RESTRICTEDPOST &&
+ hbflcheck(i, usernum))
+ return 0;
i = bcache[i - 1].level;
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 6f9079e7..65f38761 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -59,8 +59,8 @@ char * const str_permboard[] = {
"板主設定列入記錄", /* BRD_BMCOUNT */
"連結看板", /* BRD_SYMBOLIC */
"不可噓", /* BRD_NOBOO */
- "沒想到",
- "沒想到",
+ "預設 Local Save", /* BRD_LOCALSAVE */
+ "限板友發文", /* BRD_RESTRICTEDPOST */
"沒想到",
"沒想到",
"沒想到",
diff --git a/sample/etc/board.help b/sample/etc/board.help
index c7acc731..3a702134 100644
--- a/sample/etc/board.help
+++ b/sample/etc/board.help
@@ -18,6 +18,6 @@
【 板主命令 】
(M/o) 舉行投票/編私投票名單 (m/c/g/^Z) 保留/選錄精華/文摘/置底
(D) 刪除一段範圍的文章 (T/B) 重編文章標題/重編看板標題
- (I) 開放/禁止看板推薦 (t/^D) 標記文章/砍除標記的文章
+ (I/^E) 開放/禁止看板推薦/發文(t/^D) 標記文章/砍除標記的文章
(O)/(i) 發表注意事項 文章類別 (H)/(Y) 看板隱藏/現身 取消推薦文章
(^G) 舉辦賭盤/停止下注/開獎(W/K/v) 編進板畫面/水桶名單/可見名單