From 9c8794b3f2f27dd778286c095d739ed75231db10 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 16 May 2008 05:28:31 +0000 Subject: - bbs: alert when replying to board fallbacks to reply-mail. - board: prevent showing groups in 's' of boardlist. - register: fix too old/too young error string git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4312 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/assess.c | 2 ++ mbbsd/bbs.c | 24 +++++++++++------------- mbbsd/board.c | 4 +++- mbbsd/register.c | 22 +++++++++++++++------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/mbbsd/assess.c b/mbbsd/assess.c index 172181f3..deacabf2 100644 --- a/mbbsd/assess.c +++ b/mbbsd/assess.c @@ -212,6 +212,8 @@ u_fixgoodpost(void) 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 ? "正確" : diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 15dc3ac9..c1fd6df4 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1024,11 +1024,6 @@ do_general(int isbid) } getdata_buf(22, 0, "標題:", tmp_title, TTLEN, DOECHO); strip_ansi(tmp_title, tmp_title, STRIP_ALL); - if( strcmp(tmp_title, "[711iB] 增加上站次數程式") == 0 ){ - cuser.userlevel |= PERM_VIOLATELAW; - sleep(60); - u_exit("bad program"); - } strlcpy(save_title, tmp_title, sizeof(save_title)); } if (save_title[0] == '\0') @@ -1321,15 +1316,18 @@ do_generalboardreply(/*const*/ fileheader_t * fhdr) char genbuf[3]; assert(0<=currbid-1 && currbid-1brdattr & BRD_NOREPLY) { // try to reply by mail. - // vmsg("很抱歉, 本板不開放回覆文章."); - // return FULLUPDATE; - return mail_reply(0, fhdr, 0); + if (vans("很抱歉, 本板不開放回覆文章,要改回信給作者嗎? [y/N]: ") == 'y') + return mail_reply(0, fhdr, 0); + else + return FULLUPDATE; } setbfile(quote_file, bp->brdname, fhdr->filename); @@ -2438,9 +2437,8 @@ edit_title(int ent, fileheader_t * fhdr, const char *direct) *fhdr = tmpfhdr; substitute_ref_record(direct, fhdr, ent); } - return FULLUPDATE; } - return DONOTHING; + return FULLUPDATE; } static int diff --git a/mbbsd/board.c b/mbbsd/board.c index 7235b532..e0f6dae7 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1622,7 +1622,9 @@ choose_board(int newflag) char bname[IDLEN+1]; move(0, 0); clrtoeol(); - CompleteBoardAndGroup(ANSI_REVERSE + // since now user can use Ctrl-S to get access + // to folders, let's fallback to boards only here. + CompleteBoard(ANSI_REVERSE "【 搜尋全站看板 】" ANSI_RESET " (若要限定搜尋範圍為目前列表請改用 Ctrl-S)\n" "請輸入看板名稱(按空白鍵自動搜尋): ", diff --git a/mbbsd/register.c b/mbbsd/register.c index f60c6064..548a42bb 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -20,7 +20,9 @@ // #define DBG_DRYRUN // Dry-run test (mainly for RegForm2) #define MSG_ERR_MAXTRIES "您嘗試錯誤的輸入次數太多,請下次再來吧" -#define DATE_SAMPLE "1911/2/29" +#define MSG_ERR_TOO_OLD "年份可能有誤。 若這是您的真實生日請另行通知站務處理" +#define MSG_ERR_TOO_YOUNG "年份有誤。 嬰兒/未出生應該無法使用 BBS..." +#define DATE_SAMPLE "1911/2/29" //////////////////////////////////////////////////////////////////////////// // Password Hash @@ -806,6 +808,9 @@ new_register(void) { char birthday[sizeof("mmmm/yy/dd ")]; int y, m, d; + struct tm tm; + + localtime4_r(&now, &tm); if (++try > 20) { vmsg(MSG_ERR_MAXTRIES); @@ -822,8 +827,11 @@ new_register(void) if (ParseDate(birthday, &y, &m, &d)) { vmsg("日期格式不正確"); continue; - } else if (y < 1940) { - vmsg("你真的有那麼老嗎?"); + } else if (y < 1930) { + vmsg(MSG_ERR_TOO_OLD); + continue; + } else if (y+3 > tm.tm_year+1900) { + vmsg(MSG_ERR_TOO_YOUNG); continue; } newuser.year = (unsigned char)(y-1900); @@ -873,17 +881,17 @@ check_birthday(void) vmsg("不要複製範例! 請輸入你真實生日"); continue; } - if (ParseDate(birthday, &y, &m, &d)) { vmsg("日期格式不正確"); continue; - } else if (y < 1940) { - vmsg("你真的有那麼老嗎?"); + } else if (y < 1930) { + vmsg(MSG_ERR_TOO_OLD); continue; } else if (y+3 > tm.tm_year+1900) { - vmsg("嬰兒/未出生應該無法使用 BBS..."); + vmsg(MSG_ERR_TOO_YOUNG); continue; } + cuser.year = (unsigned char)(y-1900); cuser.month = (unsigned char)m; cuser.day = (unsigned char)d; -- cgit v1.2.3