summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-29 22:31:57 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-29 22:31:57 +0800
commit6b2f2f3e275322f0cfeccf57d35350edae0de6a0 (patch)
treeb430757aeebfdbf35b532349ca46ca7bbd144685
parent3a5906defc274d40f0e58eec77048cdeb8ad64fa (diff)
downloadpttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.tar
pttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.tar.gz
pttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.tar.bz2
pttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.tar.lz
pttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.tar.xz
pttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.tar.zst
pttbbs-6b2f2f3e275322f0cfeccf57d35350edae0de6a0.zip
* (pwcu branch) remove the 'goodpost' ~ I love this commit.
git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4791 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/assess.c213
-rw-r--r--mbbsd/bbs.c39
-rw-r--r--mbbsd/menu.c2
-rw-r--r--mbbsd/passwd.c11
-rw-r--r--mbbsd/talk.c2
-rw-r--r--mbbsd/user.c7
6 files changed, 3 insertions, 271 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index e11ac70f..aa9abe71 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -26,217 +26,6 @@ int inc_##_attr(const char *userid, int num) \
return 0;\
}
-modify_column(goodpost); /* inc_goodpost */
modify_column(badpost); /* inc_badpost */
-// how long is AID? see read.c...
-#ifndef AIDC_LEN
-#define AIDC_LEN (20)
-#endif // AIDC_LEN
-
-// #define MAXGP (100)
-#define MAXGP (UCHAR_MAX)
-
-int
-u_fixgoodpost(void)
-{
- char endinput = 0;
- unsigned int newgp = 0;
- int bid;
- char bname[IDLEN+1];
- char xaidc[AIDC_LEN+1];
-
- aidu_t gpaids[MAXGP+1];
- int gpbids[MAXGP+1];
- int cgps = 0;
-
- clear();
- vs_hdr("自動優文修正程式");
-
- outs("開始修正優文之前,有些功\課要麻煩您先查好:\n\n"
- "請先找到你所有的優文文章的看板與" AID_DISPLAYNAME "\n"
- AID_DISPLAYNAME "的查詢方法是在該篇文章前面按下大寫 Q 。\n"
- "查好後請把這些資料放在手邊,等下會請您輸入。\n"
- "另外,若有多重登入請先關閉其它連線。\n"
- "\n");
- outs("如果一切都準備好了,請按下 y 開始,或其它任意鍵跳出。\n\n");
- if (vans("優文的資料都查好了嗎?") != 'y')
- {
- vmsg("跳出修正程式。");
- return 0;
- }
- while (!endinput && newgp < MAXGP)
- {
- int y;
- boardheader_t *bh = NULL;
-
- move(1, 0); clrtobot();
- outs("請依序輸入優文資訊,全部完成後按 ENTER 即可停止。\n");
-
- move(b_lines-2, 0); clrtobot();
- prints("目前已確認優文數目: %d" ANSI_RESET "\n\n", newgp);
-
- if (!getdata(5, 0, "請輸入優文文章所在看板名稱: ",
- bname, sizeof(bname), DOECHO))
- {
- move(5, 0);
- if (vans(ANSI_COLOR(1;33)"確定全部輸入完成了嗎? "
- ANSI_RESET "[y/N]: ") != 'y')
- continue;
- endinput = 1; break;
- }
- move (6, 0);
- outs("確認看板... ");
- if (bname[0] == '\0' || !(bid = getbnum(bname)))
- {
- outs(ANSI_COLOR(1;31) "看板不存在!");
- vmsg("請重新輸入。");
- continue;
- }
- assert(0<=bid-1 && bid-1<MAX_BOARD);
- bh = getbcache(bid);
- strlcpy(bname, bh->brdname, sizeof(bname));
- prints("已找到看板 --> %s\n", bname);
- y = vgety();
-
- // loop AID query
- while (newgp < MAXGP)
- {
- int n;
- int fd;
- char dirfile[PATHLEN];
- char *sp;
- aidu_t aidu = 0;
- fileheader_t fh;
-
- move(y, 0); clrtobot();
- move(b_lines-2, 0); clrtobot();
- prints("目前已確認優文數目: %d" ANSI_RESET "\n\n", newgp);
-
- if (getdata(y, 0, "請輸入" AID_DISPLAYNAME ": #",
- xaidc, AIDC_LEN, DOECHO) == 0)
- break;
-
- sp = xaidc;
- while(*sp == ' ') sp ++;
- if(*sp == '#') sp ++;
-
- if((aidu = aidc2aidu(sp)) <= 0)
- {
- outs(ANSI_COLOR(1;31) AID_DISPLAYNAME "格式不正確!");
- vmsg("請重新輸入。");
- continue;
- }
-
- // check repeated input of same board+AID.
- for (n = 0; n < cgps; n++)
- {
- if (gpaids[n] == aidu && gpbids[n] == bid)
- {
- vmsg("您已輸入過此優文了,請重新輸入。");
- aidu = 0;
- break;
- }
- }
-
- if (aidu <= 0)
- continue;
-
- // find aidu in board
- n = -1;
- // see read.c, search .bottom first.
- if (n < 0)
- {
- outs("搜尋置底文章...");
- setbfile(dirfile, bname, FN_DIR ".bottom");
- n = search_aidu(dirfile, aidu);
- }
- if (n < 0) {
- // search board
- outs("未找到。\n搜尋看板文章..");
- setbfile(dirfile, bname, FN_DIR);
- n = search_aidu(dirfile, aidu);
- }
- if (n < 0)
- {
- // search digest
- outs("未找到。\n搜尋文摘..");
- setbfile(dirfile, currboard, fn_mandex);
- n = search_aidu(dirfile, aidu);
- }
- if (n < 0)
- {
- // search failed...
- outs("未找到\n" ANSI_COLOR(1;31) "找不到文章!");
- vmsg("請確認後重新輸入。");
- continue;
- }
-
- // found something
- fd = open(dirfile, O_RDONLY);
- if (fd < 0)
- {
- outs(ANSI_COLOR(1;31) "系統錯誤。 請稍候再重試。\n");
- vmsg("若持續發生請至" BN_BUGREPORT "報告。");
- continue;
- }
-
- lseek(fd, n*sizeof(fileheader_t), SEEK_SET);
- memset(&fh, 0, sizeof(fh));
- read(fd, &fh, sizeof(fh));
- outs("\n開始核對資料...\n");
- n = 1;
- // XXX 要接受大小寫不同嗎? (改 id)
- // 常改 id 不是好事,要改就要承受無法回復的風險,完。
- if (strcmp(fh.owner, cuser.userid) != 0)
- n = 0;
- prints("作者: %s (%s)\n", fh.owner, n ? "正確" :
- ANSI_COLOR(1;31) "錯誤" ANSI_RESET);
- if (!(fh.filemode & FILE_MARKED))
- n = 0;
- prints("M文: %s\n", (fh.filemode & FILE_MARKED) ? "正確" :
- ANSI_COLOR(1;31) "錯誤" ANSI_RESET);
- prints("推薦: %d\n", fh.recommend);
- close(fd);
- if (!n)
- {
- vmsg("輸入的文章並非優文,請重新輸入。");
- continue;
- }
- n = fh.recommend / 10;
- prints("計算優文數值: %+d\n", n);
-
- if (n > 0)
- {
- // log new data
- newgp += n;
- gpaids[cgps] = aidu;
- gpbids[cgps] = bid;
- cgps ++;
- }
-
- clrtobot();
-
-
- vmsg("優文已確認。若要輸入其它看板文章請在AID欄空白按 ENTER");
- }
- vmsgf("%s 看板輸入完成。", bname);
- }
- if (newgp > MAXGP)
- newgp = MAXGP;
- if (newgp <= cuser.goodpost)
- {
- vmsg("確認優文數目未高於已有優文數,不調整。");
- } else {
- log_filef("log/fixgoodpost.log", LOG_CREAT,
- "%s %s 自動修正優文數: 由 %d 變為 %d\n", Cdate(&now), cuser.userid,
- cuser.goodpost, newgp);
- // update passwd file here?
- pwcuSetGoodPost(newgp);
- vmsgf("更新優文數目為%d。", newgp);
- }
-
- return 0;
-}
-
-#endif
+#endif // ASSESS
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index d1f268e3..f0356a46 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -2342,14 +2342,6 @@ recommend_cancel(int ent, fileheader_t * fhdr, const char *direct)
getdata(b_lines - 1, 0, "確定要推薦歸零[y/N]? ", yn, 5, LCECHO);
if (yn[0] != 'y')
return FULLUPDATE;
-#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;
substitute_ref_record(direct, fhdr, ent);
@@ -2765,20 +2757,6 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
}
do_add_recommend(direct, fhdr, ent, buf, type);
-
-#ifdef ASSESS
- /* 每 10 次推文 加一次 goodpost */
- // TODO 轉來的怎麼辦?
- // when recommend reaches MAX_RECOMMENDS...
- if (type == RECTYPE_GOOD && (fhdr->filemode & FILE_MARKED) &&
- (fhdr->recommend != oldrecom) &&
- fhdr->recommend % 10 == 0)
- {
- inc_goodpost(fhdr->owner, 1);
- sendalert(fhdr->owner, ALERT_PWD_GOODPOST);
- }
-#endif
-
lastrecommend = now;
lastrecommend_bid = currbid;
strlcpy(lastrecommend_fname, fhdr->filename, sizeof(lastrecommend_fname));
@@ -2801,23 +2779,6 @@ mark_post(int ent, fileheader_t * fhdr, const char *direct)
return DONOTHING;
fhdr->filemode ^= FILE_MARKED;
-
-#ifdef ASSESS
- 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
-
substitute_ref_record(direct, fhdr, ent);
check_locked(fhdr);
return PART_REDRAW;
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index bd598cea..fdba2381 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -585,7 +585,6 @@ u_myfiles()
}
-int u_fixgoodpost(void); // assess.c
void Customize(); // user.c
static int
@@ -611,7 +610,6 @@ static const commands_t userlist[] = {
{u_register, MENU_UNREGONLY, "RRegister 填寫《註冊申請單》"},
#ifdef ASSESS
{u_cancelbadpost,PERM_LOGINOK, "BBye BadPost 申請刪除劣文"},
- {u_fixgoodpost, PERM_LOGINOK, "FFix GoodPost 修復優文"},
#endif // ASSESS
{NULL, 0, NULL}
};
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 5803b5b8..73f3f6fc 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -47,8 +47,6 @@ passwd_sync_update(int num, userec_t * buf)
if(alerts & ALERT_PWD_BADPOST)
cuser.badpost = buf->badpost = u.badpost;
- if(alerts & ALERT_PWD_GOODPOST)
- cuser.goodpost = buf->goodpost = u.goodpost;
if(alerts & ALERT_PWD_PERM)
cuser.userlevel = buf->userlevel = u.userlevel;
if(alerts & ALERT_PWD_JUSTIFY)
@@ -146,15 +144,6 @@ pwcuDecNumPost()
PWCU_END();
}
-int
-pwcuSetGoodPost(unsigned int newgp)
-{
- PWCU_START();
- cuser.goodpost = u.goodpost = newgp;
- // passwd_force_update(ALERT_PWD_GOODPOST);
- PWCU_END();
-}
-
int
pwcuViolateLaw ()
{
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 068cd567..14f55478 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -481,7 +481,7 @@ my_query(const char *uident)
#endif
move(2, 40);
#ifdef ASSESS
- prints("《有效文章篇數》%d篇 (優:%d/劣:%d)\n", muser.numposts, muser.goodpost, muser.badpost);
+ prints("《有效文章篇數》%d篇 (劣:%d)\n", muser.numposts, muser.badpost);
#else
prints("《有效文章篇數》%d篇\n", muser.numposts);
#endif
diff --git a/mbbsd/user.c b/mbbsd/user.c
index c14d5bf1..84a2d83e 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -197,8 +197,7 @@ user_display(const userec_t * u, int adminmode)
// conditional fields
#ifdef ASSESS
- prints("\t\t優 劣 文: 優:%d / 劣:%d\n",
- u->goodpost, u->badpost);
+ prints("\t\t劣文數目: %d\n", u->badpost);
#endif // ASSESS
#ifdef CHESSCOUNTRY
@@ -816,10 +815,6 @@ uinfo_query(userec_t *u, int adminmode, int unum)
if ((tmp = atoi(buf)) >= 0)
x.numposts = tmp;
#ifdef ASSESS
- snprintf(genbuf, sizeof(genbuf), "%d", u->goodpost);
- if (getdata_str(y++, 0, "優良文章數:", buf, 10, DOECHO, genbuf))
- if ((tmp = atoi(buf)) >= 0)
- x.goodpost = tmp;
snprintf(genbuf, sizeof(genbuf), "%d", u->badpost);
if (getdata_str(y++, 0, "惡劣文章數:", buf, 10, DOECHO, genbuf))
if ((tmp = atoi(buf)) >= 0)