diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-08-14 16:18:04 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-08-14 16:18:04 +0800 |
commit | 0c7e57a96f6e95e783934f4823cfe60b8e0aa829 (patch) | |
tree | 2054291e4442dbc0a210042fa189077ab91ad124 | |
parent | c7b7837b0606304d6b842b9d4ad9e06e898c835a (diff) | |
download | pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.tar pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.tar.gz pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.tar.bz2 pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.tar.lz pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.tar.xz pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.tar.zst pttbbs-0c7e57a96f6e95e783934f4823cfe60b8e0aa829.zip |
Change default my fav to be one entry in editable.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5855 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/fav.c | 36 | ||||
-rw-r--r-- | pttbbs/sample/etc/editable | 1 | ||||
-rw-r--r-- | pttbbs/sample/etc/myfav_defaults | 1 |
3 files changed, 18 insertions, 20 deletions
diff --git a/pttbbs/mbbsd/fav.c b/pttbbs/mbbsd/fav.c index 123563ae..1ab239c3 100644 --- a/pttbbs/mbbsd/fav.c +++ b/pttbbs/mbbsd/fav.c @@ -1218,30 +1218,26 @@ void subscribe_newfav(void) // create defaults for new user void reginit_fav(void) { + const char *default_favs = "etc/myfav_defaults"; + char bn[STRLEN]; + FILE *fp; int bid = 0; fav_load(); // for creating root -#ifdef BN_NEWBIE - bid = getbnum(BN_NEWBIE); - if (bid > 0) fav_add_board(bid); -#endif - -#ifdef BN_TEST - bid = getbnum(BN_TEST); - if (bid > 0) fav_add_board(bid); -#endif - -#ifdef BN_ASKBOARD - bid = getbnum(BN_ASKBOARD); - if (bid > 0) fav_add_board(bid); -#endif - -#ifdef BN_SYSOP - bid = getbnum(BN_SYSOP); - if (bid > 0) fav_add_board(bid); -#endif - + fp = fopen(default_favs, "r"); + if (fp) { + while (fgets(bn, sizeof(bn), fp)) { + chomp(bn); + strip_blank(bn, bn); + if (!*bn || *bn == '#') + continue; + bid = getbnum(bn); + if (bid > 0) + fav_add_board(bid); + } + fclose(fp); + } fav_save(); } diff --git a/pttbbs/sample/etc/editable b/pttbbs/sample/etc/editable index a997f3e5..1599781f 100644 --- a/pttbbs/sample/etc/editable +++ b/pttbbs/sample/etc/editable @@ -27,6 +27,7 @@ etc/Welcome_login.4 進站畫面4 # 一般檔案 # ---------------------------------------- etc/crosspost.txt 過度轉錄開的罰單通知信 +etc/myfav_defaults 我的最愛預設列表 etc/post.note 發文注意事項 etc/expire.conf 看板期限 etc/feast 節日 diff --git a/pttbbs/sample/etc/myfav_defaults b/pttbbs/sample/etc/myfav_defaults new file mode 100644 index 00000000..9c6ed538 --- /dev/null +++ b/pttbbs/sample/etc/myfav_defaults @@ -0,0 +1 @@ +SYSOP |