From f953897b997b26b8069f920b3eb85eef5cd84ccb Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 3 Jul 2005 07:54:53 +0000 Subject: pmore: warning for **X board: category color update, thanks to ledia i'm not sure should we use 16 color or not, so let's stay in compatible mode first. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2879 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/board.c | 9 ++------- mbbsd/pmore.c | 50 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 22 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/board.c b/mbbsd/board.c index dcd9dfb5..9b6c0b87 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -461,7 +461,7 @@ make_class_color(char *name) return colorset[(unsigned int) (name[0] + name[1] + - name[2] + name[3]) & 07]; + name[2] + name[3]) & 0x7]; } #define HILIGHT_COLOR ANSI_COLOR(1;36) @@ -501,9 +501,6 @@ show_brdlist(int head, int clsflag, int newflag) } if (brdnum > 0) { boardstat_t *ptr; - char *color[8] = {"", ANSI_COLOR(32), - ANSI_COLOR(33), ANSI_COLOR(36), ANSI_COLOR(34), ANSI_COLOR(1), - ANSI_COLOR(1;32), ANSI_COLOR(1;33)}; char *unread[2] = {ANSI_COLOR(37) " " ANSI_RESET, ANSI_COLOR(1;31) "ˇ" ANSI_RESET}; if (IS_LISTING_FAV() && get_data_number(get_current_fav()) == 0){ @@ -574,9 +571,7 @@ show_brdlist(int head, int clsflag, int newflag) ((!(cuser.uflag2 & FAVNOHILIGHT) && getboard(ptr->bid) != NULL))? ANSI_COLOR(1;36) : "", B_BH(ptr)->brdname, - color[(unsigned int) - (B_BH(ptr)->title[1] + B_BH(ptr)->title[2] + - B_BH(ptr)->title[3] + B_BH(ptr)->title[0]) & 07], + make_class_color(B_BH(ptr)->title), B_BH(ptr)->title, B_BH(ptr)->title + 5, B_BH(ptr)->title + 7); #ifdef USE_COOLDOWN diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 83134a24..ccb77c58 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -895,9 +895,13 @@ MFDISP_DBCS_HEADERWIDTH(int originalw) MFDISP_FORCEUPDATE2BOT(); \ } +static char *override_msg = NULL; +static char *override_attr = NULL; + /* * display mf content from disps for MFDISP_PAGE */ + void mf_display() { @@ -1209,7 +1213,7 @@ mf_display() } #ifdef PMORE_USE_PTT_PRINTS - /* special case to resolve dirty Ptt_Prints */ + /* special case to resolve dirty Ptt_prints */ if(inAnsi && mf.end - mf.dispe > 2 && *(mf.dispe+1) == '*') @@ -1224,7 +1228,12 @@ mf_display() if(bpref.rawmode) buf[0] = '*'; else + { Ptt_prints(buf, NO_RELOAD); // result in buf + override_attr = ANSI_COLOR(0;30;41); + override_msg = " 注意: 此頁有控制碼," + "若顯示您的個人資訊可能並非原內容 "; + } i = strlen(buf); if (col + i > maxcol) @@ -1543,7 +1552,6 @@ pmore(char *fpath, int promptend) int flExit = 0, retval = 0; int ch = 0; int invalidate = 1; - char *override_msg = NULL; /* simple re-entrant hack * I don't want to write pointers everywhere, @@ -1823,8 +1831,9 @@ pmore(char *fpath, int promptend) if(override_msg) { - buf[0] = ' '; - snprintf(buf+1, sizeof(buf)-1, override_msg); + buf[0] = 0; + if(override_attr) outs(override_attr); + snprintf(buf, sizeof(buf), override_msg); override_msg = NULL; } else @@ -2149,12 +2158,14 @@ pmore(char *fpath, int promptend) { case MFDISP_WRAP_WRAP: bpref.wrapmode = MFDISP_WRAP_TRUNCATE; - // override_msg = ANSI_COLOR(31) "已設定為截行模式(不自動斷行)"; + // override_attr = ANSI_COLOR(31); + // override_msg = " 已設定為截行模式(不自動斷行)"; vmsg("斷行方式已設定為截行模式(不自動斷行)"); break; case MFDISP_WRAP_TRUNCATE: bpref.wrapmode = MFDISP_WRAP_WRAP; - // override_msg = ANSI_COLOR(34) "已設定為自動斷行模式"; + // override_attr = ANSI_COLOR(34); + // override_msg = " 已設定為自動斷行模式"; vmsg("斷行方式已設定為自動斷行(預設)"); break; } @@ -2163,10 +2174,12 @@ pmore(char *fpath, int promptend) case 'W': bpref.indicator = !bpref.indicator; if(bpref.indicator) - // override_msg = ANSI_COLOR(34) "顯示斷行符號"; + // override_attr = ANSI_COLOR(34); + // override_msg = " 顯示斷行符號"; vmsg("設定為斷行時顯示斷行符號(預設)"); else - // override_msg = ANSI_COLOR(31) "不再顯示斷行符號"; + // override_attr = ANSI_COLOR(31); + // override_msg = " 不再顯示斷行符號"; vmsg("設定為斷行時不顯示斷行符號"); MFDISP_DIRTY(); break; @@ -2180,17 +2193,20 @@ pmore(char *fpath, int promptend) { case MFDISP_SEP_OLD: bpref.seperator = MFDISP_SEP_LINE; - // override_msg = ANSI_COLOR(31) "設定為單行分隔線"; + // override_attr = ANSI_COLOR(31); + // override_msg = " 設定為單行分隔線"; vmsg("分隔線設定為單行分隔線"); break; case MFDISP_SEP_LINE: bpref.seperator = 0; - // override_msg = ANSI_COLOR(31) "設定為無分隔線"; + // override_attr = ANSI_COLOR(31); + // override_msg = " 設定為無分隔線"; vmsg("設定為無分隔線"); break; default: bpref.seperator = MFDISP_SEP_OLD; - // override_msg = ANSI_COLOR(34) "傳統分隔線加空行"; + // override_attr = ANSI_COLOR(34); + // override_msg = " 傳統分隔線加空行"; vmsg("分隔線設定為傳統分隔線加空行(預設)"); break; } @@ -2226,20 +2242,24 @@ pmore(char *fpath, int promptend) switch(bpref.rawmode) { case MFDISP_RAW_NA: - // override_msg = ANSI_COLOR(34) "顯示預設格式化內容"; + // override_attr = ANSI_COLOR(34); + // override_msg = " 顯示預設格式化內容"; vmsg("顯示方式設定為預設格式化內容"); break; /* case MFDISP_RAW_NOFMT: - override_msg = ANSI_COLOR(31) "省略自動格式化"; + // override_attr = ANSI_COLOR(31); + // override_msg = " 省略自動格式化"; break; */ case MFDISP_RAW_NOANSI: - // override_msg = ANSI_COLOR(33) "顯示原始 ANSI 控制碼"; + // override_attr = ANSI_COLOR(33); + // override_msg = " 顯示原始 ANSI 控制碼"; vmsg("顯示方式設定為顯示原始 ANSI 控制碼"); break; case MFDISP_RAW_PLAIN: - // override_msg = ANSI_COLOR(37) "顯示純文字"; + // override_attr = ANSI_COLOR(37); + // override_msg = " 顯示純文字"; vmsg("顯示方式設定為純文字"); break; } -- cgit v1.2.3