diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2012-12-24 22:43:57 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2012-12-24 22:43:57 +0800 |
commit | 7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7 (patch) | |
tree | 3dc91af443e28e4a17a5a01a3117ac0565d38bca | |
parent | 5c87492108d39571c2aceeaf6bba2e93db29ce58 (diff) | |
download | pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.tar pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.tar.gz pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.tar.bz2 pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.tar.lz pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.tar.xz pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.tar.zst pttbbs-7a7ae8e8ded770f2e7157b0272a7c64ceaaf9af7.zip |
Correct BM logic in posting by using BMcache. #1Gs20jW3 (PttBug)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5742 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 6329a2ae..d70622db 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -1188,7 +1188,14 @@ do_crosspost(const char *brd, fileheader_t *postfile, const char *fpath) } static int -do_general(int garbage GCC_UNUSED) +does_board_have_any_bm(int bid) { + // in common/cache.c, BMcache uids were assigned in order, so we only need + // to check first UID. + return (SHM->BMcache[bid - 1][0] != -1); +} + +static int +do_post_article() { fileheader_t postfile; char fpath[PATHLEN], buf[STRLEN]; @@ -1384,7 +1391,7 @@ do_general(int garbage GCC_UNUSED) #ifdef USE_HIDDEN_BOARD_NOCREDIT (currbrdattr & BRD_HIDE) || #endif - bp->BM[0] < ' ') // XXX note: BM may contain some (chinese) text that is not userid + !does_board_have_any_bm(currbid)) { money = 0; } @@ -1566,7 +1573,7 @@ do_post(void) if (bp->brdattr & BRD_VOTEBOARD) return do_voteboard(0); else if (!(bp->brdattr & BRD_GROUPBOARD)) - return do_general(0); + return do_post_article(); return 0; } @@ -3349,7 +3356,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) is_anon = (fhdr->filemode & FILE_ANONYMOUS); if(is_anon) /* When the file is anonymous posted, fhdr->multi.anon_uid is author. - * see do_general() */ + * see do_post_article() */ tusernum = fhdr->multi.anon_uid; else tusernum = searchuser(fhdr->owner, NULL); @@ -3724,7 +3731,7 @@ view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr, if(fhdr->filemode & FILE_ANONYMOUS) /* When the file is anonymous posted, fhdr->multi.anon_uid is author. - * see do_general() */ + * see do_post_article() */ prints("│ 匿名管理編號: %u (同一人號碼會一樣)", (unsigned int)fhdr->multi.anon_uid + (unsigned int)currutmp->pid); else { |