From 626083aaf4aab32a54f541dc5007e823082e0427 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 28 Jun 2009 13:53:40 +0000 Subject: * code refine * change the default value for using 'boo' in 'no_boo' from 'good' to 'comment (arrow)'. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4712 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 68c27ebb..80eeb0aa 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -17,11 +17,18 @@ static int view_postinfo(int ent, const fileheader_t * fhdr, const char *direct, static int bnote_lastbid = -1; // 決定是否要顯示進板畫面的 cache +// recommend/comment types +// most people use recommendation just for one-line reply. +// so we may change default to (RECTYPE_ARROW)= comment only. +// however, the traditional behavior (which does not have +// BRC info for 'new comments available') uses RECTYPE_GOOD. enum { RECTYPE_GOOD, RECTYPE_BAD, RECTYPE_ARROW, - RECTYPE_MAX=RECTYPE_ARROW, + + RECTYPE_MAX = RECTYPE_ARROW, + RECTYPE_DEFAULT = RECTYPE_GOOD, // match traditional user behavior }; #ifdef ASSESS @@ -2874,12 +2881,6 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) #ifndef OLDRECOMMEND else { - /* most people use recommendation just for one-line reply. - * so we change default to (RECTYPE_ARROW)= comment only now. -#define RECOMMEND_DEFAULT_VALUE (RECTYPE_ARROW) - */ -#define RECOMMEND_DEFAULT_VALUE (RECTYPE_GOOD) /* current user behavior */ - move(b_lines, 0); clrtoeol(); outs(ANSI_COLOR(1) "您覺得這篇文章 "); @@ -2895,13 +2896,23 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) prints("%s3.%s " ANSI_RESET "[%d]? ", ctype_attr[2], ctype_long[2], - RECOMMEND_DEFAULT_VALUE+1); + RECTYPE_DEFAULT+1); + + type = igetch(); + + if (!isascii(type) || !isdigit(type)) + { + type = RECTYPE_DEFAULT; + } else { + type -= '1'; + if (type < 0 || type > RECTYPE_MAX) + type = RECTYPE_DEFAULT; + } - type = igetch() - '1'; if( (bp->brdattr & BRD_NOBOO) && (type == RECTYPE_BAD)) - type = RECOMMEND_DEFAULT_VALUE; - if(type < 0 || type > RECTYPE_MAX) - type = RECOMMEND_DEFAULT_VALUE; + type = RECTYPE_ARROW; + assert(type >= 0 && type <= RECTYPE_MAX); + move(b_lines, 0); clrtoeol(); } #endif -- cgit v1.2.3