From 1b162d305b32d23c79f7d483344167f86c2a7f59 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 16 Dec 2007 08:16:38 +0000 Subject: - fix bug "good post dropped if user online" git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3693 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/pttstruct.h | 18 +++--------------- mbbsd/bbs.c | 12 ++++++++++++ mbbsd/passwd.c | 2 ++ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/pttstruct.h b/include/pttstruct.h index 9042cfca..d7cb7500 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -172,6 +172,7 @@ typedef struct boardheader_t { char pad3[47]; } boardheader_t; +// TODO BRD 快爆了,怎麼辦? 準備從 pad3 偷一個來當 attr2 吧... #define BRD_NOZAP 0x00000001 /* 不可zap */ #define BRD_NOCOUNT 0x00000002 /* 不列入統計 */ #define BRD_NOTRAN 0x00000004 /* 不轉信 */ @@ -311,7 +312,8 @@ typedef struct msgque_t { #define ISNEWMAIL(utmp) utmp->alerts & ALERT_NEW_MAIL #define ALERT_PWD_PERM 2 #define ALERT_PWD_BADPOST 4 -#define ALERT_PWD (ALERT_PWD_PERM|ALERT_PWD_BADPOST) +#define ALERT_PWD_GOODPOST 8 +#define ALERT_PWD (ALERT_PWD_PERM|ALERT_PWD_BADPOST|ALERT_PWD_GOODPOST) /* user data in shm */ /* use GAP to detect and avoid data overflow and overriding */ typedef struct userinfo_t { @@ -670,18 +672,4 @@ typedef struct { } ocfs_t; #endif -// kcwu: for bug tracking -/* not used right now */ -enum { - F_VER, - F_EDIT, - F_MORE, - F_WRITE_REQUEST, - F_TALK_REQUEST, - F_WATER, - F_USERLIST, - F_GEM, -}; - - #endif diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 784ca75c..2d068841 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2329,7 +2329,10 @@ recommend_cancel(int ent, fileheader_t * fhdr, const char *direct) #ifdef ASSESS // to save resource if (fhdr->recommend > 9) + { inc_goodpost(fhdr->owner, -1 * (fhdr->recommend / 10)); + sendalert(fhdr->owner, ALERT_PWD_GOODPOST); + } #endif fhdr->recommend = 0; @@ -2859,7 +2862,10 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) #ifdef ASSESS /* 每 10 次推文 加一次 goodpost */ if (type ==0 && (fhdr->filemode & FILE_MARKED) && fhdr->recommend % 10 == 0) + { inc_goodpost(fhdr->owner, 1); + sendalert(fhdr->owner, ALERT_PWD_GOODPOST); + } #endif lastrecommend = now; @@ -2889,10 +2895,16 @@ mark_post(int ent, fileheader_t * fhdr, const char *direct) if (!(fhdr->filemode & FILE_BID)){ if (fhdr->filemode & FILE_MARKED) { if (!(currbrdattr & BRD_BAD) && fhdr->recommend >= 10) + { inc_goodpost(fhdr->owner, fhdr->recommend / 10); + sendalert(fhdr->owner, ALERT_PWD_GOODPOST); + } } else if (fhdr->recommend > 9) + { inc_goodpost(fhdr->owner, -1 * (fhdr->recommend / 10)); + sendalert(fhdr->owner, ALERT_PWD_GOODPOST); + } } #endif diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c index 036d6d99..15323be2 100644 --- a/mbbsd/passwd.c +++ b/mbbsd/passwd.c @@ -82,6 +82,8 @@ passwd_update(int num, userec_t * buf) passwd_query(num, &u); if(pwdfd & ALERT_PWD_BADPOST) cuser.badpost = buf->badpost = u.badpost; + if(pwdfd & ALERT_PWD_GOODPOST) + cuser.goodpost = buf->goodpost = u.goodpost; if(pwdfd & ALERT_PWD_PERM) cuser.userlevel = buf->userlevel = u.userlevel; currutmp->alerts &= ~ALERT_PWD; -- cgit v1.2.3