diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-11-14 11:20:02 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-11-14 11:20:02 +0800 |
commit | 540ae46da972dbbac64c293bbd5d7e1304ca837e (patch) | |
tree | de9cf04c4ca1b7c2e27dcf518bae22cbee0d8b79 | |
parent | 162021fd3f135ff7f225898165060d1f8b3bfd09 (diff) | |
download | pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.tar pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.tar.gz pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.tar.bz2 pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.tar.lz pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.tar.xz pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.tar.zst pttbbs-540ae46da972dbbac64c293bbd5d7e1304ca837e.zip |
'K' is only for root fav
git-svn-id: http://opensvn.csie.org/pttbbs/branches/victor.fav4.bak@1328 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/include/proto.h | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/board.c | 7 | ||||
-rw-r--r-- | pttbbs/mbbsd/fav.c | 11 |
3 files changed, 17 insertions, 2 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index b21e1f08..1f24894a 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -240,6 +240,7 @@ int fav_v3_to_v4(void); int is_visible_item(fav_type_t *ft); int is_set_attr(fav_type_t *ft, char bit); void cleanup(void); +char current_fav_at_root(void); /* friend */ void friend_edit(int type); diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c index 57deb048..8780b9f9 100644 --- a/pttbbs/mbbsd/board.c +++ b/pttbbs/mbbsd/board.c @@ -335,6 +335,8 @@ void load_brdbuf(void) if( (fd = open(fname, O_RDONLY)) == -1 ){ fav_v3_to_v4(); } + else + close(fd); fav_load(); updatenewfav(1); firsttime = 0; @@ -1174,6 +1176,11 @@ choose_board(int newflag) if (HAS_PERM(PERM_BASIC)) { char c, fname[80], genbuf[256]; int fd; + if (!current_fav_at_root()) { + vmsg("請到我的最愛最上層執行本功\能"); + break; + } + c = getans("請選擇 1)清除不可見看板 2)備份我的最愛 3)取回最愛備份 [Q]"); if(!c) break; diff --git a/pttbbs/mbbsd/fav.c b/pttbbs/mbbsd/fav.c index 32c3c51b..d6dac03c 100644 --- a/pttbbs/mbbsd/fav.c +++ b/pttbbs/mbbsd/fav.c @@ -203,6 +203,10 @@ inline static fav_t *get_fav_root(void){ return fav_stack[0]; } +char current_fav_at_root(void) { + return get_current_fav() == get_fav_root(); +} + /* is it an unvisable entry */ inline int is_visible_item(fav_type_t *ft){ if (!(ft->attr & FAVH_FAV)) @@ -434,7 +438,7 @@ int fav_save(void) cleanup(); setuserfile(buf, FAV4".tmp"); setuserfile(buf2, FAV4); - fd = open(buf, O_CREAT| O_TRUNC | O_WRONLY, 0600); + fd = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0600); if (fd < 0) return -1; write_favrec(fd, fp); @@ -484,6 +488,9 @@ static void fav_free_branch(fav_t *fp) void fav_free(void) { fav_free_branch(get_fav_root()); + + /* reset the stack */ + fav_stack_num = 0; } /* --- */ @@ -646,7 +653,7 @@ static fav_type_t *init_add(fav_t *fp, int type) fav_type_t *fav_add_line(void) { fav_t *fp = get_current_fav(); - if (get_folder_num(fp) >= MAX_LINE) + if (get_line_num(fp) >= MAX_LINE) return NULL; fav_type_t *ft = init_add(fp, FAVT_LINE); if (ft == NULL) |