summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-08-04 22:13:02 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-08-04 22:13:02 +0800
commit4f371a15c597440cacdd0b815294707ad824f22b (patch)
treed1f6ab71c4685354802701de285e2d760bc4e978 /mbbsd
parentf514f537625817bee4cdc55a5c9374c39855042a (diff)
downloadpttbbs-4f371a15c597440cacdd0b815294707ad824f22b.tar
pttbbs-4f371a15c597440cacdd0b815294707ad824f22b.tar.gz
pttbbs-4f371a15c597440cacdd0b815294707ad824f22b.tar.bz2
pttbbs-4f371a15c597440cacdd0b815294707ad824f22b.tar.lz
pttbbs-4f371a15c597440cacdd0b815294707ad824f22b.tar.xz
pttbbs-4f371a15c597440cacdd0b815294707ad824f22b.tar.zst
pttbbs-4f371a15c597440cacdd0b815294707ad824f22b.zip
debug goodpost & bad post
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2157 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/assess.c25
-rw-r--r--mbbsd/bbs.c18
-rw-r--r--mbbsd/mbbsd.c14
3 files changed, 21 insertions, 36 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index 5ceb0564..562e3ac8 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -15,16 +15,14 @@ inline static void inc(unsigned char *num, int n)
}
#define modify_column(name) \
-int inc_##name(int uid, int num) \
+int inc_##name(char *userid, int num) \
{ \
- userinfo_t *user; \
- passwd_query(uid, &xuser); \
- inc(&xuser.name, num); \
- user = search_ulist(uid); \
- if (user != NULL) \
- user->name = xuser.name; \
- passwd_update(uid, &xuser); \
- return xuser.name; \
+ int uid = getuser(userid);\
+ if(uid>0 ){ \
+ inc(&xuser.name, num); \
+ passwd_update(uid, &xuser); \
+ return xuser.name; }\
+ return 0;\
}
modify_column(goodpost); /* inc_goodpost */
@@ -32,10 +30,11 @@ 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)
+#if 0 //unused function
+void set_assess(char *userid, unsigned char num, int type)
{
- passwd_query(uid, &xuser);
+ int uid = getuser(userid);
+ if(uid<=0) return;
switch (type){
case GOODPOST:
xuser.goodpost = num;
@@ -53,3 +52,5 @@ void set_assess(int uid, unsigned char num, int type)
passwd_update(uid, &xuser);
}
#endif
+
+#endif
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 301fbaf3..fcde90b4 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1312,7 +1312,7 @@ recommend_cancel(int ent, fileheader_t * fhdr, char *direct)
#ifdef ASSESS
// to save resource
if (fhdr->recommend > 9)
- inc_goodpost(searchuser(fhdr->owner), -1 * (fhdr->recommend / 10));
+ inc_goodpost(fhdr->owner, -1 * (fhdr->recommend / 10));
#endif
fhdr->recommend = 0;
@@ -1397,10 +1397,10 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp,
if ('1' <= tmp && tmp <= '3'){
switch(tmp){
case 1:
- inc_goodsale(currutmp->uid, 1);
+ inc_goodsale(bidinfo.userid, 1);
break;
case 2:
- inc_badpost(currutmp->uid, 1);
+ inc_badpost(bidinfo.userid, 1);
break;
}
bidinfo.flag |= SALE_COMMENTED;
@@ -1586,10 +1586,8 @@ recommend(int ent, fileheader_t * fhdr, char *direct)
#ifdef ASSESS
/* 每 10 次推文 加一次 goodpost */
if (type ==0 && (fhdr->filemode & FILE_MARKED) && fhdr->recommend % 10 == 0) {
- int uid = searchuser(fhdr->owner);
- if (uid > 0)
- inc_goodpost(uid, 1);
- }
+ inc_goodpost(fdhr->owner, 1);
+ }
#endif
lastrecommend = now;
return FULLUPDATE;
@@ -1616,10 +1614,10 @@ mark_post(int ent, fileheader_t * fhdr, char *direct)
if (!(fhdr->filemode & FILE_BID)){
if (fhdr->filemode & FILE_MARKED) {
if (!(currbrdattr & BRD_BAD) && fhdr->recommend >= 10)
- inc_goodpost(searchuser(fhdr->owner), fhdr->recommend / 10);
+ inc_goodpost(fhdr->owner, fhdr->recommend / 10);
}
else if (fhdr->recommend > 9)
- inc_goodpost(searchuser(fhdr->owner), -1 * (fhdr->recommend / 10));
+ inc_goodpost(fhdr->owner, -1 * (fhdr->recommend / 10));
}
#endif
@@ -1746,7 +1744,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
getdata(b_lines, 0, "請輸入原因", reason, sizeof(reason), DOECHO);
else
strcpy(reason, badpost_reason[i - 1]);
- if (!(inc_badpost(num, 1) % 10)){
+ if (!(inc_badpost(xuser.userid, 1) % 10)){
post_violatelaw(xuser.userid, "Ptt 系統警察", "劣文累計十篇", "罰單一張");
mail_violatelaw(xuser.userid, "Ptt 系統警察", "劣文累計十篇", "罰單一張");
xuser.userlevel |= PERM_VIOLATELAW;
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index c202e786..2dae5632 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -143,13 +143,6 @@ u_exit(char *mode)
save_brdbuf();
brc_finalize();
-#ifdef ASSESS
- cuser.goodpost = currutmp->goodpost;
- cuser.badpost = currutmp->badpost;
- cuser.goodsale = currutmp->goodsale;
- cuser.badsale = currutmp->badsale;
-#endif
-
cuser.invisible = currutmp->invisible;
cuser.pager = currutmp->pager;
memcpy(cuser.mind, currutmp->mind, 4);
@@ -741,13 +734,6 @@ setup_utmp(int mode)
uinfo.mode = currstat = mode;
uinfo.mailalert = load_mailalert(cuser.userid);
-#ifdef ASSESS
- uinfo.goodpost = cuser.goodpost;
- uinfo.badpost = cuser.badpost;
- uinfo.goodsale = cuser.goodsale;
- uinfo.badsale = cuser.badsale;
-#endif
-
uinfo.userlevel = cuser.userlevel;
uinfo.sex = cuser.sex % 8;
uinfo.lastact = time(NULL);