summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h6
-rw-r--r--mbbsd/bbs.c2
-rw-r--r--mbbsd/io.c3
-rw-r--r--mbbsd/passwd.c30
-rw-r--r--mbbsd/user.c3
5 files changed, 40 insertions, 4 deletions
diff --git a/include/proto.h b/include/proto.h
index ea232c78..db785acc 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -107,7 +107,6 @@ void brc_update(void);
void brc_toggle_all_read(int bid, int is_all_read);
/* cache */
-#define demoney(money) deumoney(usernum, money)
unsigned int getutmpmode(void);
void setutmpmode(unsigned int mode);
void purge_utmp(userinfo_t *uentp);
@@ -126,7 +125,6 @@ const char * postperm_msg(const char *bname);
int give_tax(int money);
const char* money_level(int money);
int vice(int money, const char* item);
-#define reload_money() // cuser.money=moneyof(usernum)
int lockutmpmode(int unmode, int state);
int unlockutmpmode(void);
int x_file(void);
@@ -688,6 +686,8 @@ int passwd_sync_update (int num, userec_t * buf);
int passwd_sync_query (int num, userec_t * buf);
// current user help utilities
+#define reload_money() pwcuReloadMoney()
+#define demoney(money) pwcuDeMoney(money)
int pwcuBitEnableLevel (unsigned int mask);
int pwcuBitDisableLevel (unsigned int mask);
int pwcuIncNumPost ();
@@ -731,6 +731,8 @@ int pwcuToggleUserFlag2 (unsigned int mask); // not saved until pwcuSaveUserFlag
int pwcuLoginSave ();
int pwcuExitSave ();
int pwcuReload ();
+int pwcuReloadMoney ();
+int pwcuDeMoney (int money);
// initialization
void pwcuInitZero ();
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;
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 375d1a6d..432b4004 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -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) {