From 0283b33c66acb173a2cb7bac19a79048c755cd41 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 22 Jul 2005 19:33:38 +0000 Subject: option to toggle cp auto log for both entire site def and board conf. also updated board conf (for recommendation/cp auto log) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2944 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 19 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index fb69613b..819f7455 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1169,16 +1169,16 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) addsignature(xptr, 0); fclose(xptr); - /* now point bp to new bord */ - bp = getbcache(getbnum(xboard)); - - /* add cp log */ +#ifdef AUTO_CP_LOG + /* add cp log. bp is currboard now. */ + if(!(bp->brdattr & BRD_NOCPLOG)) { char buf[MAXPATHLEN]; char bname[STRLEN] = ""; struct tm *ptime = localtime4(&now); int maxlength = 51 +2 - 6; + bp = getbcache(getbnum(xboard)); if ((bp->brdattr & BRD_HIDE) && (bp->brdattr & BRD_POSTMASK)) { /* mosaic it */ @@ -1206,7 +1206,10 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) cuser.userid, bname, maxlength, "", fromhost, ptime->tm_mon + 1, ptime->tm_mday); do_add_recommend(direct, fhdr, ent, buf, 2); - } + } else +#endif + /* now point bp to new bord */ + bp = getbcache(getbnum(xboard)); /* * Cross fs有問題 } else { unlink(xfpath); link(fname, xfpath); } @@ -2553,29 +2556,88 @@ static int b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct) { boardheader_t *bp=NULL; + int touched = 0; if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) return DONOTHING; bp = getbcache(currbid); + move(b_lines - 6, 0); clrtobot(); + outs(MSG_SEPERATOR); + outs("\n目前看板設定:\n"); + prints(" - %s 推薦文章\n", + (bp->brdattr & BRD_NORECOMMEND) ? "不可":"可以"); +#ifndef OLDRECOMMEND + prints(" - %s 噓文\n", + ((bp->brdattr & BRD_NORECOMMEND) || (bp->brdattr & BRD_NOBOO)) + ? "不可":"可以"); +#endif +#ifdef AUTO_CP_LOG + prints(" - 轉錄文章時 %s 自動記錄\n", + (bp->brdattr & BRD_NOCPLOG) ? "不會":"會"); +#endif -#ifdef OLDRECOMMEND - bp->brdattr ^= BRD_NORECOMMEND; + switch(tolower(getans("請按 r%s%s 設定可否 推文%s%s: ", +#ifndef OLDRECOMMEND + "/b", #else - if(bp->brdattr & BRD_NOBOO) - bp->brdattr ^= BRD_NORECOMMEND; - if(!(bp->brdattr & BRD_NORECOMMEND) || !(bp->brdattr & BRD_NOBOO)) - bp->brdattr ^= BRD_NOBOO; + "", #endif - - substitute_record(fn_board, bp, sizeof(boardheader_t), currbid); - +#ifdef AUTO_CP_LOG + "/x", +#else + "", +#endif +#ifndef OLDRECOMMEND + "噓文/", +#else + "", +#endif +#ifdef AUTO_CP_LOG + "轉錄自動記錄" +#else + "" +#endif + ))) + { +#ifdef AUTO_CP_LOG + case 'x': + bp->brdattr ^= BRD_NOCPLOG; + touched = 1; + vmsg("已設定為自本板轉錄文章將 %s 自動留下記錄", + (bp->brdattr & BRD_NOCPLOG) ? "不會" : "會" + ); + break; +#endif + case 'r': + bp->brdattr ^= BRD_NORECOMMEND; + touched = 1; #ifdef OLDRECOMMEND - vmsg("本板現在 %s 推薦", - (bp->brdattr & BRD_NORECOMMEND) ? "禁止" : "開放"); + vmsg("本板現在 %s 推薦", + (bp->brdattr & BRD_NORECOMMEND) ? "禁止" : "開放"); + break; #else - vmsg("本板現在 %s 推薦, %s 噓聲", - (bp->brdattr & BRD_NORECOMMEND) ? "禁止" : "開放", - (bp->brdattr & BRD_NOBOO) ? "禁止" : "開放"); + vmsg("本板現在 %s 推薦, %s 噓聲", + (bp->brdattr & BRD_NORECOMMEND) ? "禁止" : "開放", + ((bp->brdattr & BRD_NORECOMMEND)||(bp->brdattr & BRD_NOBOO)) ? "禁止" : "開放"); + break; + case 'b': + if(bp->brdattr & BRD_NORECOMMEND) + bp->brdattr |= BRD_NOBOO; + bp->brdattr ^= BRD_NOBOO; + touched = 1; + if (!(bp->brdattr & BRD_NOBOO)) + bp->brdattr &= ~BRD_NORECOMMEND; + vmsg("本板現在 %s 推薦, %s 噓聲", + (bp->brdattr & BRD_NORECOMMEND) ? "禁止" : "開放", + ((bp->brdattr & BRD_NORECOMMEND)||(bp->brdattr & BRD_NOBOO)) ? "禁止" : "開放"); + break; #endif + default: + vmsg("未改變任何設定"); + break; + } + if(touched) + substitute_record(fn_board, bp, sizeof(boardheader_t), currbid); + return FULLUPDATE; } -- cgit v1.2.3