diff options
-rw-r--r-- | include/pttstruct.h | 11 | ||||
-rw-r--r-- | mbbsd/assess.c | 14 |
2 files changed, 15 insertions, 10 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index 6689e851..a0c8e140 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -316,7 +316,6 @@ typedef struct userinfo_t { char from[27]; /* machine name the user called in from */ int from_alias; char birth; /* 是否是生日 Ptt*/ - char tty[11]; /* tty port */ short nFriends; /* 下面 friend[] 只用到前幾個, 用來 bsearch */ int friend[MAX_FRIEND]; @@ -324,7 +323,6 @@ typedef struct userinfo_t { /* 好友比較的cache 前兩個bit是狀態 */ int reject[MAX_REJECT]; unsigned short int chess_elo_rating; - char pad[2]; int lock; int friendtotal; /* 好友比較的cache 大小 */ char msgcount; @@ -335,12 +333,19 @@ typedef struct userinfo_t { unsigned char lockmode; /* 不准 multi_login 玩的東西 */ char turn; /* for gomo */ char mateid[IDLEN + 1]; /* for gomo */ + + /* 為了 sync 回 .PASSWDS 時使用 */ unsigned short int five_win; unsigned short int five_lose; unsigned short int five_tie; unsigned short int chc_win; unsigned short int chc_lose; unsigned short int chc_tie; + unsigned short int goodpost; + unsigned short int badpost; + unsigned short int goodsale; + unsigned short int badsale; + char mailalert; char sex; char color; @@ -469,7 +474,7 @@ typedef struct { } e; } GV2; - /* fromcache */ + /* 故鄉 fromcache */ unsigned int home_ip[MAX_FROM]; unsigned int home_mask[MAX_FROM]; char home_desc[MAX_FROM][32]; diff --git a/mbbsd/assess.c b/mbbsd/assess.c index 489054d4..ae5c43a2 100644 --- a/mbbsd/assess.c +++ b/mbbsd/assess.c @@ -14,16 +14,16 @@ inline static void inc(unsigned char *num, int n) (*num) += n; } -/* FIXME race occurs when he's online. - * passwd_update in mbbsd.c:u_exit() override the later value. */ -#define modify_column(name) \ -int inc_##name(char *userid, int num) \ +#define modify_column(_attr) \ +int inc_##_attr(char *userid, int num) \ { \ int uid = getuser(userid);\ if(uid>0 ){ \ - inc(&xuser.name, num); \ - passwd_update(uid, &xuser); \ - return xuser.name; }\ + userinfo_t *uinfo = search_ulistn(uid); \ + inc(&uinfo->_attr, num); \ + inc(&xuser._attr, num); \ + passwd_update(uid, &xuser); \ + return xuser._attr; }\ return 0;\ } |