From e3d9790af8488b115475131fb928ed974604abfc Mon Sep 17 00:00:00 2001 From: victor Date: Sun, 4 Jan 2004 11:51:50 +0000 Subject: show non-visible board in fav git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1457 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/board.c | 74 ++++++++++++++++++++++++++++++--------------------------- mbbsd/convert.c | 3 --- mbbsd/fav.c | 22 +++++++---------- 3 files changed, 48 insertions(+), 51 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/board.c b/mbbsd/board.c index 77cdc756..8a45215a 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -517,7 +517,7 @@ load_boards(char *key) nbrd = (boardstat_t *)malloc(sizeof(boardstat_t) * get_data_number(fav)); for( i = 0 ; i < fav->DataTail; ++i ){ int state; - if (!is_visible_item(&fav->favh[i])) + if (!(fav->favh[i].attr & FAVH_FAV)) continue; if ( !key[0] ){ @@ -525,16 +525,16 @@ load_boards(char *key) state = BRD_LINE; else if (get_item_type(&fav->favh[i]) == FAVT_FOLDER ) state = BRD_FOLDER; - else{ + else { bptr = &bcache[ fav_getid(&fav->favh[i]) - 1]; - if( Ben_Perm(bptr) ) + if( yank_flag == 0 ) state = BRD_BOARD; else continue; if (is_set_attr(&fav->favh[i], FAVH_UNREAD)) state |= BRD_UNREAD; } - }else{ + } else { if (get_item_type(&fav->favh[i]) == FAVT_LINE ) continue; else if (get_item_type(&fav->favh[i]) == FAVT_FOLDER ){ @@ -798,35 +798,40 @@ show_brdlist(int head, int clsflag, int newflag) unread[ptr->myattr & BRD_UNREAD ? 1 : 0]); } if (class_bid != 1) { - prints("%s%-13s\033[m%s%5.5s\033[0;37m%2.2s\033[m" - "%-34.34s", - ((!(cuser.uflag2 & FAVNOHILIGHT) && - getboard(ptr->bid) != NULL))? "\033[1;36m" : "", - B_BH(ptr)->brdname, - color[(unsigned int) - (B_BH(ptr)->title[1] + B_BH(ptr)->title[2] + - B_BH(ptr)->title[3] + B_BH(ptr)->title[0]) & 07], - B_BH(ptr)->title, B_BH(ptr)->title + 5, B_BH(ptr)->title + 7); - - if (B_BH(ptr)->brdattr & BRD_BAD) - prints(" X "); - else if (B_BH(ptr)->nuser >= 5000) - prints("\033[1;34mĂz!\033[m"); - else if (B_BH(ptr)->nuser >= 2000) - prints("\033[1;31mĂz!\033[m"); - else if (B_BH(ptr)->nuser >= 1000) - prints("\033[1mĂz!\033[m"); - else if (B_BH(ptr)->nuser >= 100) - prints("\033[1mHOT\033[m"); - else if (B_BH(ptr)->nuser > 50) - prints("\033[1;31m%2d\033[m ", B_BH(ptr)->nuser); - else if (B_BH(ptr)->nuser > 10) - prints("\033[1;33m%2d\033[m ", B_BH(ptr)->nuser); - else if (B_BH(ptr)->nuser > 0) - prints("%2d ", B_BH(ptr)->nuser); - else - prints(" %c ", B_BH(ptr)->bvote ? 'V' : ' '); - prints("%.*s\033[K", t_columns - 67, B_BH(ptr)->BM); + if (Ben_Perm(B_BH(ptr)) != 1) { + prints(" ÁôȘO"); + } + else { + prints("%s%-13s\033[m%s%5.5s\033[0;37m%2.2s\033[m" + "%-34.34s", + ((!(cuser.uflag2 & FAVNOHILIGHT) && + getboard(ptr->bid) != NULL))? "\033[1;36m" : "", + B_BH(ptr)->brdname, + color[(unsigned int) + (B_BH(ptr)->title[1] + B_BH(ptr)->title[2] + + B_BH(ptr)->title[3] + B_BH(ptr)->title[0]) & 07], + B_BH(ptr)->title, B_BH(ptr)->title + 5, B_BH(ptr)->title + 7); + + if (B_BH(ptr)->brdattr & BRD_BAD) + prints(" X "); + else if (B_BH(ptr)->nuser >= 5000) + prints("\033[1;34mĂz!\033[m"); + else if (B_BH(ptr)->nuser >= 2000) + prints("\033[1;31mĂz!\033[m"); + else if (B_BH(ptr)->nuser >= 1000) + prints("\033[1mĂz!\033[m"); + else if (B_BH(ptr)->nuser >= 100) + prints("\033[1mHOT\033[m"); + else if (B_BH(ptr)->nuser > 50) + prints("\033[1;31m%2d\033[m ", B_BH(ptr)->nuser); + else if (B_BH(ptr)->nuser > 10) + prints("\033[1;33m%2d\033[m ", B_BH(ptr)->nuser); + else if (B_BH(ptr)->nuser > 0) + prints("%2d ", B_BH(ptr)->nuser); + else + prints(" %c ", B_BH(ptr)->bvote ? 'V' : ' '); + prints("%.*s\033[K", t_columns - 67, B_BH(ptr)->BM); + } } else { prints("%-40.40s %.*s", B_BH(ptr)->title + 7, t_columns - 67, B_BH(ptr)->BM); @@ -1337,8 +1342,7 @@ choose_board(int newflag) } if (!(B_BH(ptr)->brdattr & BRD_GROUPBOARD)) { /* «Dsub class */ - if (!(B_BH(ptr)->brdattr & BRD_HIDE) || - (B_BH(ptr)->brdattr & BRD_POSTMASK)) { + if (Ben_Perm(B_BH(ptr)) == 1) { brc_initial(B_BH(ptr)->brdname); if (newflag) { diff --git a/mbbsd/convert.c b/mbbsd/convert.c index 75480ab1..8f6d5120 100644 --- a/mbbsd/convert.c +++ b/mbbsd/convert.c @@ -1,8 +1,5 @@ /* $Id: convert.c 1374 2003-11-27 14:11:40Z victor $ */ #include "bbs.h" -/* - * The following code is copied and modified from "autoconvert" with GPL. - */ #ifdef CONVERT diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 587dc041..338375f7 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -210,13 +210,9 @@ char current_fav_at_root(void) { return get_current_fav() == get_fav_root(); } -/* is it an unvisable entry */ -inline int is_visible_item(fav_type_t *ft){ - if (!(ft->attr & FAVH_FAV)) - return 0; - if (get_item_type(ft) != FAVT_BOARD) - return 1; - return Ben_Perm(&bcache[cast_board(ft)->bid - 1]); +/* is it an valid entry */ +inline int valid_item(fav_type_t *ft){ + return ft->attr & FAVH_FAV; } /* return: the exact number after cleaning @@ -235,13 +231,13 @@ static void rebuild_fav(fav_t *fp) continue; ft = &fp->favh[i]; switch (get_item_type(ft)){ -/* case FAVT_BOARD: +/* bid = cast_board(ft)->bid; if (SHM->GV2.e.cleanboard && bcache[bid - 1].brdname[0]) continue; - break; */ + break; case FAVT_LINE: cast_line(ft)->lid = fp->lineID + 1; break; @@ -495,7 +491,7 @@ static fav_type_t *get_fav_item(short id, int type) for(i = 0; i < fp->DataTail; i++){ ft = &fp->favh[i]; - if (!is_visible_item(ft) || get_item_type(ft) != type) + if (!valid_item(ft) || get_item_type(ft) != type) continue; if (fav_getid(ft) == id) return ft; @@ -615,11 +611,11 @@ static void move_in_folder(fav_t *fav, int from, int to) /* Find real locations of from and to in fav->favh[] */ for(count = i = 0; count <= from; i++) - if (is_visible_item(&fav->favh[i])) + if (valid_item(&fav->favh[i])) count++; from = i - 1; for(count = i = 0; count <= to; i++) - if (is_visible_item(&fav->favh[i])) + if (valid_item(&fav->favh[i])) count++; to = i - 1; @@ -800,7 +796,7 @@ static void fav_do_recursively(fav_t *fp, int (*act)(fav_t *)) fav_type_t *ft; for(i = 0; i < fp->DataTail; i++){ ft = &fp->favh[i]; - if (!is_visible_item(ft)) + if (!valid_item(ft)) continue; if (get_item_type(ft) == FAVT_FOLDER && get_fav_folder(ft) != NULL){ fav_do_recursively(get_fav_folder(ft), act); -- cgit v1.2.3