summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h2
-rw-r--r--mbbsd/bbs.c32
-rw-r--r--mbbsd/friend.c7
3 files changed, 39 insertions, 2 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 73b6b469..348187fc 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -182,7 +182,7 @@ typedef struct boardheader_t {
unsigned char bvote; /* 正舉辦 Vote 數 */
time4_t vtime; /* Vote close time */
unsigned int level; /* 可以看此板的權限 */
- int unused; /* 還沒用到 */
+ time4_t perm_reload; /* 最後設定看板的時間 */
int gid; /* 看板所屬的類別 ID */
int next[2]; /* 在同一個gid下一個看板 動態產生*/
int firstchild[2]; /* 屬於這個看板的第一個子看板 */
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 95ae518f..0ce450b8 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -141,8 +141,38 @@ set_board(void)
int
CheckPostPerm(void)
{
- if (!(currmode & MODE_POSTCHECKED)) {
+ static time4_t last_chk_time = 0x0BAD0BB5; /* any magic number */
+ static int last_board_index = 0; /* for speed up */
+ int valid_index = 0;
+ boardheader_t *bp = NULL;
+
+ if (currmode & MODE_POSTCHECKED)
+ {
+ /* checked? let's check if perm reloaded */
+ if (last_board_index < 1 || last_board_index > SHM->Bnumber)
+ {
+ /* invalid board index, refetch. */
+ last_board_index = getbnum(currboard);
+ valid_index = 1;
+ }
+ bp = getbcache(last_board_index);
+
+ if(bp->perm_reload != last_chk_time)
+ currmode &= ~MODE_POSTCHECKED;
+ }
+
+ if (!(currmode & MODE_POSTCHECKED))
+ {
+ if(!valid_index)
+ {
+ last_board_index = getbnum(currboard);
+ bp = getbcache(last_board_index);
+ }
+ last_chk_time = bp->perm_reload;
currmode |= MODE_POSTCHECKED;
+
+ // vmsg("reload board postperm");
+
if (haspostperm(currboard)) {
currmode |= MODE_POST;
return 1;
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index 04f2a395..407560e0 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -447,6 +447,13 @@ friend_edit(int type)
fputs(genbuf, fp);
fclose(fp);
}
+ } else if (type == BOARD_WATER) {
+ boardheader_t *bp =
+ getbcache(getbnum(currboard));
+ bp->perm_reload = now;
+ /* should we flush perm_reload?
+ * not really important in current implementation.
+ */
}
friend_load(0);
}