From b50ccfc1d4bab8bdc998f0bcadae66b73a1603a8 Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 1 Dec 2003 04:41:01 +0000 Subject: fix assess, it may be rewriten git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1385 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/pttstruct.h | 6 ++++-- mbbsd/assess.c | 4 ++++ mbbsd/mbbsd.c | 10 ++++++++++ util/shmctl.c | 2 -- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/pttstruct.h b/include/pttstruct.h index dd9e4b6c..9b9efe72 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -262,8 +262,10 @@ typedef struct userinfo_t { /* 好友比較的cache 前兩個bit是狀態 */ int reject[MAX_REJECT]; - int idoffset; /* shm id上的 offset */ - /* idoffset 好像沒用到 */ + unsigned char goodpost; /* 評價為好文章數 */ + unsigned char badpost; /* 評價為壞文章數 */ + unsigned char goodsale; /* 競標 好的評價 */ + unsigned char badsale; /* 競標 壞的評價 */ int lock; int friendtotal; /* 好友比較的cache 大小 */ diff --git a/mbbsd/assess.c b/mbbsd/assess.c index 957d3042..95426e26 100644 --- a/mbbsd/assess.c +++ b/mbbsd/assess.c @@ -17,6 +17,7 @@ int inc_goodpost(int uid, int num) { passwd_query(uid, &xuser); inc(&xuser.goodpost, num); + SHM->uinfo[uid - 1].goodpost = xuser.goodpost; passwd_update(uid, &xuser); return xuser.goodpost; } @@ -25,6 +26,7 @@ int inc_badpost(int uid, int num) { passwd_query(uid, &xuser); inc(&xuser.badpost, num); + SHM->uinfo[uid - 1].badpost = xuser.badpost; passwd_update(uid, &xuser); return xuser.badpost; } @@ -33,6 +35,7 @@ int inc_goodsale(int uid, int num) { passwd_query(uid, &xuser); inc(&xuser.goodsale, num); + SHM->uinfo[uid - 1].goodsale = xuser.goodsale; passwd_update(uid, &xuser); return xuser.goodsale; } @@ -41,6 +44,7 @@ int inc_badsale(int uid, int num) { passwd_query(uid, &xuser); inc(&xuser.badsale, num); + SHM->uinfo[uid - 1].badsale = xuser.badsale; passwd_update(uid, &xuser); return xuser.badsale; } diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index edd2f36d..a985c2bf 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -150,6 +150,11 @@ u_exit(char *mode) setflags(CLOAK_FLAG, currutmp->invisible); save_brdbuf(); + cuser.goodpost = currutmp->goodpost; + cuser.badpost = currutmp->badpost; + cuser.goodsale = currutmp->goodsale; + cuser.badsale = currutmp->badsale; + cuser.invisible = currutmp->invisible; cuser.pager = currutmp->pager; memcpy(cuser.mind, currutmp->mind, 4); @@ -722,6 +727,11 @@ setup_utmp(int mode) uinfo.mode = currstat = mode; uinfo.mailalert = load_mailalert(cuser.userid); + uinfo.goodpost = cuser.goodpost; + uinfo.badpost = cuser.badpost; + uinfo.goodsale = cuser.goodsale; + uinfo.badsale = cuser.badsale; + uinfo.userlevel = cuser.userlevel; uinfo.sex = cuser.sex % 8; uinfo.lastact = time(NULL); diff --git a/util/shmctl.c b/util/shmctl.c index 357b24a1..74cf3e12 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -231,8 +231,6 @@ inline void utmpsort(int sortall) } SHM->UTMPnumber = count; qsort(SHM->sorted[ns][0], count, sizeof(userinfo_t *), cmputmpuserid); - for (i = 0; i < count; ++i) - ((userinfo_t *) SHM->sorted[ns][0][i])->idoffset = i; memcpy(SHM->sorted[ns][6], SHM->sorted[ns][0], sizeof(userinfo_t *) * count); memcpy(SHM->sorted[ns][7], -- cgit v1.2.3