diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/board.c | 9 | ||||
-rw-r--r-- | mbbsd/fav.c | 31 |
2 files changed, 37 insertions, 3 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index 148f5d1d..c6ed5d7d 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -560,6 +560,8 @@ load_boards(char *key) if (is_set_attr(&fav->favh[i], FAVH_TAG)) state |= BRD_TAG; + if (is_set_attr(&fav->favh[i], FAVH_ADM_TAG)) + state |= BRD_TAG; addnewbrdstat(fav_getid(&fav->favh[i]) - 1, BRD_FAV | state); } if (brdnum == 0) @@ -1006,9 +1008,10 @@ choose_board(int newflag) } else if (yank_flag != 0) { /* 站長管理用的 tag */ - fav_type_t *ft = fav_add_board(ptr->bid); - set_attr(ft, FAVH_FAV, 0); // turn off FAVH_FAV - set_attr(ft, FAVH_ADM_TAG, 1); // turn on FAVH_ADM_TAG + if (ptr->myattr & BRD_TAG) + set_attr(getadmtag(ptr->bid), FAVH_ADM_TAG, 0); + else + fav_add_admtag(ptr->bid); } ptr->myattr ^= BRD_TAG; head = 9999; diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 08b837a6..ca3fc5b4 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -528,6 +528,19 @@ void fav_remove_item(short id, char type) fav_remove(get_current_fav(), get_fav_item(id, type)); } +fav_type_t *getadmtag(short bid) +{ + int i; + fav_t *fp = get_fav_root(); + fav_type_t *ft; + for (i = 0; i < fp->DataTail; i++) { + ft = &fp->favh[i]; + if (cast_board(ft)->bid == bid && is_set_attr(ft, FAVH_ADM_TAG)) + return ft; + } + return NULL; +} + fav_type_t *getboard(short bid) { return get_fav_item(bid, FAVT_BOARD); @@ -705,6 +718,24 @@ fav_type_t *fav_add_board(int bid) cast_board(ft)->bid = bid; return ft; } + +/* for administrator to move/administrate board */ +fav_type_t *fav_add_admtag(int bid) +{ + fav_t *fp = get_fav_root(); + fav_type_t *ft; + if (is_maxsize()) + return NULL; + ft = fav_item_allocate(FAVT_BOARD); + if (ft == NULL) + return NULL; + // turn on FAVH_ADM_TAG + set_attr(ft, FAVH_ADM_TAG, 1); + fav_add(fp, ft); + cast_board(ft)->bid = bid; + return ft; +} + /* --- */ /* everything about the tag in fav mode. |