summaryrefslogtreecommitdiffstats
path: root/mbbsd/fav.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-04-23 00:04:12 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-04-23 00:04:12 +0800
commit945cf121ce0dfea9c37183eff0b05760bdef3a1d (patch)
treede9d25b806121418f14f7b07aeb2136497da6b36 /mbbsd/fav.c
parent68a75abe1e5568bbac2dbcca6ccad8aca6a1708c (diff)
downloadpttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.tar
pttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.tar.gz
pttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.tar.bz2
pttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.tar.lz
pttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.tar.xz
pttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.tar.zst
pttbbs-945cf121ce0dfea9c37183eff0b05760bdef3a1d.zip
give a warning if too many subscribed favorites is added at the same time
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2711 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/fav.c')
-rw-r--r--mbbsd/fav.c20
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)