diff options
-rw-r--r-- | mbbsd/admin.c | 2 | ||||
-rw-r--r-- | mbbsd/board.c | 24 | ||||
-rw-r--r-- | mbbsd/fav.c | 12 |
3 files changed, 18 insertions, 20 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c index f2e82bfa..ecea3176 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -501,7 +501,7 @@ m_mod_board(char *bname) system(genbuf); memset(&bh, 0, sizeof(bh)); snprintf(bh.title, sizeof(bh.title), - "%s 看板 %s 刪除", bname, cuser.userid); + " %s 看板 %s 刪除", bname, cuser.userid); post_msg("Security", bh.title, "請注意刪除的合法性", "[系統安全局]"); substitute_record(fn_board, &bh, sizeof(bh), bid); reset_board(bid); diff --git a/mbbsd/board.c b/mbbsd/board.c index 01a529cb..cd7aed81 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -234,16 +234,10 @@ cmpboardfriends(const void *brd, const void *tmp) static void load_boards(char *key) { - boardheader_t *bptr = NULL; int type = cuser.uflag & BRDSORT_FLAG ? 1 : 0; - int i, n, bid; + int i; int state; - if (IN_CLASS()) { - bptr = getbcache(class_bid); - if (bptr->firstchild[type] == 0 ) - load_uidofgid(class_bid, type); - } brdnum = 0; if (nbrd) { free(nbrd); @@ -269,7 +263,6 @@ load_boards(char *key) else if (get_item_type(&fav->favh[i]) == FAVT_FOLDER ) state = NBRD_FOLDER; else { - bptr = getbcache(fav_getid(&fav->favh[i])); state = NBRD_BOARD; if (is_set_attr(&fav->favh[i], FAVH_UNREAD)) state |= NBRD_UNREAD; @@ -286,7 +279,7 @@ load_boards(char *key) else continue; }else{ - bptr = getbcache(fav_getid(&fav->favh[i])); + boardheader_t *bptr = getbcache(fav_getid(&fav->favh[i])); if( HasBoardPerm(bptr) && strcasestr(bptr->title, key)) state = NBRD_BOARD; else @@ -319,8 +312,9 @@ load_boards(char *key) else { // general case nbrd = (boardstat_t *) malloc(sizeof(boardstat_t) * numboards); for (i = 0; i < numboards; i++) { - n = SHM->bsorted[type][i]; - if (n<0 || (bptr = &bcache[n]) == NULL) + int n = SHM->bsorted[type][i]; + boardheader_t *bptr = &bcache[n]; + if (n < 0 || bptr == NULL) continue; if (!bptr->brdname[0] || (bptr->brdattr & (BRD_GROUPBOARD | BRD_SYMBOLIC)) || @@ -339,7 +333,13 @@ load_boards(char *key) qsort(nbrd, brdnum, sizeof(boardstat_t), cmpboardfriends); #endif } else { /* load boards of a subclass */ - int childcount = bptr->childcount; + boardheader_t *bptr = getbcache(class_bid); + int childcount = bptr->childcount; + int bid; + + if (bptr->firstchild[type] == 0 ) + load_uidofgid(class_bid, type); + nbrd = (boardstat_t *) malloc((childcount+2) * sizeof(boardstat_t)); // 預留兩個以免大量開板時掛調 for (bid = bptr->firstchild[type]; bid > 0 && diff --git a/mbbsd/fav.c b/mbbsd/fav.c index a4a5802e..0b367fa4 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -300,12 +300,12 @@ inline int valid_item(fav_type_t *ft){ /** * 清除 fp(dir) 中無效的 entry/dir,如果 clean_invisible == true,該 user - * 看不見的看板也會被清除。 + * 看不見的看板也會被清除。「無效」指的是沒有 FAVH_FAV flag,所以不包含不 + * 存在的看板。 */ static void rebuild_fav(fav_t *fp, int clean_invisible) { int i, j, nData; - boardheader_t *bp; fav_type_t *ft; fav_number = 0; @@ -320,11 +320,9 @@ static void rebuild_fav(fav_t *fp, int clean_invisible) ft = &fp->favh[i]; switch (get_item_type(ft)){ case FAVT_BOARD: - bp = &bcache[cast_board(ft)->bid - 1]; - if (!bp->brdname[0]) - continue; - if ( clean_invisible && !HasBoardPerm(bp)) - continue; + if (clean_invisible) + if (!HasBoardPerm(&bcache[cast_board(ft)->bid - 1])); + continue; break; case FAVT_LINE: break; |