diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-01-04 19:51:50 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-01-04 19:51:50 +0800 |
commit | e3d9790af8488b115475131fb928ed974604abfc (patch) | |
tree | d22419c2b93820098b1c07fc94983815dc7563a4 | |
parent | 38262b22bfe8cfe1f7de6f272e18a3aae340f83a (diff) | |
download | pttbbs-e3d9790af8488b115475131fb928ed974604abfc.tar pttbbs-e3d9790af8488b115475131fb928ed974604abfc.tar.gz pttbbs-e3d9790af8488b115475131fb928ed974604abfc.tar.bz2 pttbbs-e3d9790af8488b115475131fb928ed974604abfc.tar.lz pttbbs-e3d9790af8488b115475131fb928ed974604abfc.tar.xz pttbbs-e3d9790af8488b115475131fb928ed974604abfc.tar.zst pttbbs-e3d9790af8488b115475131fb928ed974604abfc.zip |
show non-visible board in fav
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1457 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 1 | ||||
-rw-r--r-- | mbbsd/board.c | 74 | ||||
-rw-r--r-- | mbbsd/convert.c | 3 | ||||
-rw-r--r-- | mbbsd/fav.c | 22 | ||||
-rw-r--r-- | pttbbs.mk | 2 |
5 files changed, 49 insertions, 53 deletions
diff --git a/include/proto.h b/include/proto.h index ed883028..3e551c53 100644 --- a/include/proto.h +++ b/include/proto.h @@ -245,7 +245,6 @@ void fav_folder_in(short fid); void fav_folder_out(void); void fav_free(void); int fav_v3_to_v4(void); -int is_visible_item(fav_type_t *ft); int is_set_attr(fav_type_t *ft, char bit); void cleanup(void); char current_fav_at_root(void); 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爆!\033[m"); - else if (B_BH(ptr)->nuser >= 2000) - prints("\033[1;31m爆!\033[m"); - else if (B_BH(ptr)->nuser >= 1000) - prints("\033[1m爆!\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(" 隱板"); + } + 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爆!\033[m"); + else if (B_BH(ptr)->nuser >= 2000) + prints("\033[1;31m爆!\033[m"); + else if (B_BH(ptr)->nuser >= 1000) + prints("\033[1m爆!\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)) { /* 非sub 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); @@ -1,4 +1,4 @@ -# $Id: pttbbs.mk,v 1.8 2003/07/22 03:51:43 in2 Exp $ +# $Id$ # 定義基本初值 BBSHOME?= $(HOME) BBSHOME?= /home/bbs |