diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/fav.c | 20 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 12 |
2 files changed, 24 insertions, 8 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 9829f55a..6476ab85 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -1081,15 +1081,19 @@ void fav_set_folder_title(fav_type_t *ft, char *title) * 狦 user 秨币 FAVNEW_FLAG : * mode == 1: update 狾盢穝狾и程稲 * mode == 0: update 戈癟ぃ + * + * @return 狾计 + * PS. count 碞琵ウ计Чぃ穦Ω login 眖秨﹍计 */ -void updatenewfav(int mode) +int updatenewfav(int mode) { /* mode: 0: don't write to fav 1: write to fav */ int i, fd, brdnum; + int count = 0; char fname[80], *brd; if(!(cuser.uflag2 & FAVNEW_FLAG)) - return; + return 0; setuserfile(fname, FAVNB); @@ -1106,7 +1110,7 @@ void updatenewfav(int mode) free(brd); close(fd); vmsg("favorite subscription error"); - return; + return -1; } /* if it's a new file, no BRD_END is in it. */ @@ -1116,8 +1120,10 @@ void updatenewfav(int mode) if(brd[i] == BRD_NEW){ /* check the permission if the board exsits */ if(bcache[i].brdname[0] && HasPerm(&bcache[i])){ - if(mode && !(bcache[i].brdattr & BRD_SYMBOLIC)) + if(mode && !(bcache[i].brdattr & BRD_SYMBOLIC)) { fav_add_board(i + 1); + count++; + } brd[i] = BRD_OLD; } } @@ -1130,8 +1136,10 @@ void updatenewfav(int mode) if( i < brdnum) { // the board number may change for(; i < brdnum; ++i){ if(bcache[i].brdname[0] && HasPerm(&bcache[i])){ - if(mode && !(bcache[i].brdattr & BRD_SYMBOLIC)) + if(mode && !(bcache[i].brdattr & BRD_SYMBOLIC)) { fav_add_board(i + 1); + count++; + } brd[i] = BRD_OLD; } else @@ -1147,6 +1155,8 @@ void updatenewfav(int mode) free(brd); close(fd); } + + return count; } void subscribe_newfav(void) diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 92377e37..2d71bbd6 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1024,9 +1024,15 @@ user_login(void) if(cuser.uflag2 & FAVNEW_FLAG) { fav_load(); - /* subscribe new fav (deprecated) */ - if (get_fav_root() != NULL) - updatenewfav(1); + if (get_fav_root() != NULL) { + int num; + num = updatenewfav(1); + if (num > NEW_FAV_THRESHOLD && + getans("盢穝и程稲狾计笷 %d 絋﹚璶[N/y]", num) != 'y') { + fav_free(); + fav_load(); + } + } } for (i = 0; i < NUMVIEWFILE; i++) |