diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-13 12:02:01 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-13 12:02:01 +0800 |
commit | ce697837e94da1fa7ac0a1dc83e3518c882c5f82 (patch) | |
tree | 7f09b889ab5d54b9f478f40d5c205d9ee5355595 /mbbsd | |
parent | e3996173b492a380965b21be3a515b0f39ffa721 (diff) | |
download | pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.tar pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.tar.gz pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.tar.bz2 pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.tar.lz pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.tar.xz pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.tar.zst pttbbs-ce697837e94da1fa7ac0a1dc83e3518c882c5f82.zip |
* fix: money was not synchronized...
* also enhanced more check with explicit reload
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4835 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbs.c | 2 | ||||
-rw-r--r-- | mbbsd/io.c | 3 | ||||
-rw-r--r-- | mbbsd/passwd.c | 30 | ||||
-rw-r--r-- | mbbsd/user.c | 3 |
4 files changed, 36 insertions, 2 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index efac93c4..83a01016 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -191,6 +191,8 @@ save_violatelaw(void) clear(); vs_hdr("繳罰單中心"); + // XXX reload lots of stuff here? + pwcuReload(); if (!(cuser.userlevel & PERM_VIOLATELAW)) { vmsg("你沒有被開罰單~~"); return 0; @@ -16,6 +16,9 @@ static unsigned char real_outbuf[OBUFSIZE + CVTGAP*2] = " ", real_inbuf [IBUFSIZE + CVTGAP*2] = " "; +// we've seen such pattern - make it accessible for movie mode. +#define CLIENT_ANTI_IDLE_STR ESC_STR "OA" ESC_STR "OB" + // use defines instead - it is discovered that sometimes the input/output buffer was overflow, // without knowing why. // static unsigned char *outbuf = real_outbuf + 3, *inbuf = real_inbuf + 3; diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c index 658e7dce..667b69a5 100644 --- a/mbbsd/passwd.c +++ b/mbbsd/passwd.c @@ -30,6 +30,9 @@ passwd_sync_update(int num, userec_t * buf) if (passwd_update(num, buf) != 0) return -1; + if (num == usernum) + cuser.money = moneyof(num); + return 0; } @@ -40,6 +43,10 @@ passwd_sync_query(int num, userec_t * buf) return -1; buf->money = moneyof(num); + + if (num == usernum) + cuser.money = moneyof(num); + return 0; } @@ -49,7 +56,7 @@ static int pwcuInitCUser(userec_t *u) { assert(usernum > 0 && usernum <= MAX_USERS); - if (passwd_query(usernum, u) != 0) + if (passwd_sync_query(usernum, u) != 0) return -1; assert(strncmp(u->userid, cuser.userid, IDLEN) == 0); if (strncmp(u->userid, cuser.userid, IDLEN) != 0) @@ -62,7 +69,7 @@ pwcuFinalCUser(userec_t *u) { assert(usernum > 0 && usernum <= MAX_USERS); assert(strcmp(u->userid, cuser.userid) == 0); - if (passwd_update(usernum, u) != 0) + if (passwd_sync_update(usernum, u) != 0) return -1; return 0; } @@ -503,6 +510,10 @@ pwcuExitSave () PWCU_START(); + // XXX if PWCU_START uses sync_query, then money is + // already changed... however, maybe not a problem here, + // since every deumoney() should write difference. + // save variables for dirty check uflag = u.uflag; uflag2= u.uflag2; @@ -569,6 +580,21 @@ pwcuReload () return r; } +int +pwcuReloadMoney () +{ + cuser.money=moneyof(usernum); + return 0; +} + +int +pwcuDeMoney (int money) +{ + deumoney(usernum, money); + cuser.money = moneyof(usernum); + return 0; +} + // Initialization void pwcuInitZero () diff --git a/mbbsd/user.c b/mbbsd/user.c index 29803db1..ce93aecf 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -87,6 +87,9 @@ int u_cancelbadpost(void) return 0; } + // XXX reload account here? + pwcuReload(); + // early check for time (must do again later) day = 180 - (now - cuser.timeremovebadpost ) / DAY_SECONDS; if(day>0 && day<=180) { |