summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-24 20:28:54 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-24 20:28:54 +0800
commit7234a7e820487eff9f2abf562ff7cacbc6bd31a2 (patch)
tree9e1548cd0c48a7f185cd41870f55466038c5109e
parent36b8776e3788b80fa07f4e43288bc60ab1d69b13 (diff)
downloadpttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.tar
pttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.tar.gz
pttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.tar.bz2
pttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.tar.lz
pttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.tar.xz
pttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.tar.zst
pttbbs-7234a7e820487eff9f2abf562ff7cacbc6bd31a2.zip
Fix money bug when deleting anonymous post. (Found since some user found
that their money vanished when their article is deleted as badpost) Add some comment. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1429 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/assess.c11
-rw-r--r--mbbsd/bbs.c14
2 files changed, 16 insertions, 9 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index a9bbe10f..2e8ebd36 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -16,19 +16,20 @@ inline static void inc(unsigned char *num, int n)
#define modify_column(name) \
int inc_##name(int uid, int num) \
{ \
+ userinfo_t *user; \
passwd_query(uid, &xuser); \
inc(&xuser.name, num); \
- userinfo_t *user = search_ulist(uid); \
+ user = search_ulist(uid); \
if (user != NULL) \
user->name = xuser.name; \
passwd_update(uid, &xuser); \
return xuser.name; \
}
-modify_column(goodpost);
-modify_column(badpost);
-modify_column(goodsale);
-modify_column(badsale);
+modify_column(goodpost); /* inc_goodpost */
+modify_column(badpost); /* inc_badpost */
+modify_column(goodsale); /* inc_goodsale */
+modify_column(badsale); /* inc_badsale */
void set_assess(int uid, unsigned char num, int type)
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 6ce918c7..a50a69f3 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1855,6 +1855,8 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
/* rocker.011018: 利用reference減低loading */
fileheader_t hdr;
+ /* fhdr->money is not real money now, it's a reference instead.
+ * see select_read() in read.c */
num = fhdr->money & ~FHR_REFERENCE;
setbdir(genbuf, currboard);
get_record(genbuf, &hdr, sizeof(hdr), num);
@@ -1871,6 +1873,8 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
cancelpost(fhdr, not_owned, newpath);
if(fhdr->filemode & FILE_ANONYMOUS)
+ /* When the file is anonymous posted, fhdr->money is author.
+ * see do_general() */
num = fhdr->money;
else
num = searchuser(fhdr->owner);
@@ -1891,7 +1895,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
#endif
setbtotal(currbid);
- if (fhdr->money < 0)
+ if (fhdr->money < 0 || fhdr->filemode & FILE_ANONYMOUS)
fhdr->money = 0;
if (not_owned && strcmp(currboard, "Test")) {
deumoney(num, -fhdr->money);
@@ -1927,10 +1931,12 @@ view_postmoney(int ent, fileheader_t * fhdr, char *direct)
}
clrtoeol();
if(fhdr->filemode & FILE_ANONYMOUS)
- prints("匿名管理編號: %d (同一人被查詢時編號相同, 此編號每人看到不相同)",
- fhdr->money + currutmp->pid);
+ /* When the file is anonymous posted, fhdr->money is author.
+ * see do_general() */
+ prints("匿名管理編號: %d (同一人被查詢時編號相同, 此編號每人看到不相同)",
+ fhdr->money + currutmp->pid);
else
- prints("這一篇文章值 %d 銀", fhdr->money);
+ prints("這一篇文章值 %d 銀", fhdr->money);
refresh();
pressanykey();
return FULLUPDATE;