diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-22 21:03:29 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-22 21:03:29 +0800 |
commit | b98ca2c4a39ac4bfbd45875c493d0d6f2388d818 (patch) | |
tree | a1c9c6ea397dafeee7256f2bc6089b4a560baaff /mbbsd | |
parent | a0689bfa437cdec8d1872270b58c33647d57dfd8 (diff) | |
download | pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.tar pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.tar.gz pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.tar.bz2 pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.tar.lz pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.tar.xz pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.tar.zst pttbbs-b98ca2c4a39ac4bfbd45875c493d0d6f2388d818.zip |
ticket#30: realtime board perm update
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2938 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
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); } |