diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbs.c | 32 | ||||
-rw-r--r-- | mbbsd/friend.c | 7 |
2 files changed, 38 insertions, 1 deletions
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); } |