diff options
Diffstat (limited to 'mbbsd/fav.c')
-rw-r--r-- | mbbsd/fav.c | 20 |
1 files changed, 15 insertions, 5 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) |