From de5ce1c9adb04ed135c6c3be6110c453ac6df7aa Mon Sep 17 00:00:00 2001 From: kcwu Date: Wed, 12 Dec 2007 01:37:36 +0000 Subject: * revise code git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3670 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/proto.h | 2 +- mbbsd/announce.c | 2 +- mbbsd/bbs.c | 2 +- mbbsd/board.c | 2 +- mbbsd/cache.c | 10 +++++----- mbbsd/edit.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/proto.h b/include/proto.h index f331ff19..e1985ce6 100644 --- a/include/proto.h +++ b/include/proto.h @@ -158,7 +158,7 @@ int setumoney(int uid, int money); userinfo_t *search_ulist_pid(int pid); userinfo_t *search_ulist_userid(const char *userid); void hbflreload(int bid); -int hbflcheck(int bid, int uid); +int is_hidden_board_friend(int bid, int uid); void *attach_shm(int shmkey, int shmsize); void attach_SHM(void); int is_BM_cache(int); diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 4f6b9af0..bf6c8add 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -977,7 +977,7 @@ isvisible_man(const menu_t * me) /* board friend only effact when * in board reading mode */ (currstat == ANNOUNCE || - hbflcheck(currbid, currutmp->uid)) + !is_hidden_board_friend(currbid, currutmp->uid)) ))) return 0; return 1; diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index a69b5c7d..55ddb14f 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -188,7 +188,7 @@ set_board(void) if( HasUserPerm(PERM_SYSOP) && (bp->brdattr & BRD_HIDE) && !is_BM_cache(bp - bcache + 1) && - hbflcheck((int)(bp - bcache) + 1, currutmp->uid) ) + !is_hidden_board_friend((int)(bp - bcache) + 1, currutmp->uid) ) vmsg("進入未經授權看板"); board_note_time = &bp->bupdate; diff --git a/mbbsd/board.c b/mbbsd/board.c index 9681edf9..adfa19ef 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -161,7 +161,7 @@ HasBoardPerm(boardheader_t *bptr) /* 祕密看板:核對首席板主的好友名單 */ if (brdattr & BRD_HIDE) { /* 隱藏 */ - if (hbflcheck((int)(bptr - bcache) + 1, currutmp->uid)) { + if (!is_hidden_board_friend((int)(bptr - bcache) + 1, currutmp->uid)) { if (brdattr & BRD_POSTMASK) return 0; else diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 764aac72..5c4cb7af 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -788,7 +788,7 @@ haspostperm(const char *bname) if (bcache[i - 1].brdattr & BRD_HIDE) return 1; else if (bcache[i - 1].brdattr & BRD_RESTRICTEDPOST && - hbflcheck(i, usernum)) + !is_hidden_board_friend(i, usernum)) return 0; i = bcache[i - 1].level; @@ -1034,9 +1034,9 @@ hbflreload(int bid) memcpy(SHM->hbfl[bid-1], hbfl, sizeof(hbfl)); } -/* 是否"不"通過板友測試. 如果在板友名單中的話傳回 0, 否則為 1 */ +/* 是否通過板友測試. 如果在板友名單中的話傳回 1, 否則為 0 */ int -hbflcheck(int bid, int uid) +is_hidden_board_friend(int bid, int uid) { int i; @@ -1045,9 +1045,9 @@ hbflcheck(int bid, int uid) hbflreload(bid); for (i = 1; SHM->hbfl[bid-1][i] != 0 && i <= MAX_FRIEND; ++i) { if (SHM->hbfl[bid-1][i] == uid) - return 0; + return 1; } - return 1; + return 0; } #ifdef USE_COOLDOWN diff --git a/mbbsd/edit.c b/mbbsd/edit.c index a0e7dac2..d9151031 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1678,7 +1678,7 @@ write_file(char *fpath, int saveheader, int *islocal, char *mytitle) } curr_buf->currline = NULL; - if (postrecord.times > MAX_CROSSNUM-1 && hbflcheck(currbid, currutmp->uid)) + if (postrecord.times > MAX_CROSSNUM-1 && !is_hidden_board_friend(currbid, currutmp->uid)) anticrosspost(); if (po && sum == 3) { -- cgit v1.2.3