diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-24 12:11:53 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-24 12:11:53 +0800 |
commit | d13ca369037c5cec62c5f2af1f71b764438849a0 (patch) | |
tree | 21e9c8658ef793b72ca4e6898d7f19bd89dcc1bf /mbbsd/fav.c | |
parent | a7a964cdbf2ff45a2ade435e0dbb64638f7daf3c (diff) | |
download | pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.tar pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.tar.gz pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.tar.bz2 pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.tar.lz pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.tar.xz pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.tar.zst pttbbs-d13ca369037c5cec62c5f2af1f71b764438849a0.zip |
missing the type checking
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3077 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/fav.c')
-rw-r--r-- | mbbsd/fav.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 66175de1..5c3ee44a 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -961,12 +961,16 @@ static void fav_dosomething_tagged_item(fav_t *fp, int (*act)(fav_t *, fav_type_ static int remove_tagged_item(fav_t *fp, fav_type_t *ft) { - int i; - for(i = 0; i < FAV_MAXDEPTH && fav_stack[i] != NULL; i++) - if (fav_stack[i] == get_fav_folder(ft)){ - set_attr(ft, FAVH_TAG, FALSE); - return 0; + // do not remove the folder if it's on the stack + if (get_item_type(ft) == FAVT_FOLDER) { + int i; + for(i = 0; i < FAV_MAXDEPTH && fav_stack[i] != NULL; i++) { + if (fav_stack[i] == get_fav_folder(ft)){ + set_attr(ft, FAVH_TAG, FALSE); + return 0; + } } + } return fav_remove(fp, ft); } @@ -980,13 +984,17 @@ inline static int fav_remove_tagged_item(fav_t *fp){ */ static int add_and_remove_tag(fav_t *fp, fav_type_t *ft) { - int i; fav_type_t *tmp; - for(i = 0; i < FAV_MAXDEPTH && fav_stack[i] != NULL; i++) - if (fav_stack[i] == get_fav_folder(ft)){ - set_attr(ft, FAVH_TAG, FALSE); - return 0; + // do not remove the folder if it's on the stack + if (get_item_type(ft) == FAVT_FOLDER) { + int i; + for(i = 0; i < FAV_MAXDEPTH && fav_stack[i] != NULL; i++) { + if (fav_stack[i] == get_fav_folder(ft)){ + set_attr(ft, FAVH_TAG, FALSE); + return 0; + } } + } tmp = fav_malloc(sizeof(fav_type_t)); fav_item_copy(tmp, ft); /* since fav_item_copy is symbolic link, we disable removed link to |