summaryrefslogtreecommitdiffstats
path: root/mbbsd/board.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-12 20:53:05 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-12 20:53:05 +0800
commitdfa1b10592a2580d5e29803219a93ac511e03afa (patch)
tree8aeefd39596c25e1f7cac992e9cacdf4b8a6983f /mbbsd/board.c
parent2005e62a48dc6c0eb5d7a208eb4707617b1708b9 (diff)
downloadpttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.tar
pttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.tar.gz
pttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.tar.bz2
pttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.tar.lz
pttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.tar.xz
pttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.tar.zst
pttbbs-dfa1b10592a2580d5e29803219a93ac511e03afa.zip
a little bug of the output format
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1958 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/board.c')
-rw-r--r--mbbsd/board.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 4c97e119..7fd841f9 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -391,6 +391,18 @@ brdlist_foot()
}
+static inline char *
+make_class_color(char *name)
+{
+ char *colorset[8] = {"", "\033[32m",
+ "\033[33m", "\033[36m", "\033[34m", "\033[1m",
+ "\033[1;32m", "\033[1;33m"};
+
+ return colorset[(unsigned int)
+ (name[0] + name[1] +
+ name[2] + name[3]) & 07];
+}
+
#define HILIGHT_COLOR "\033[1;36m"
static void
@@ -428,13 +440,10 @@ show_brdlist(int head, int clsflag, int newflag)
}
if (brdnum > 0) {
boardstat_t *ptr;
- char *colorset[8] = {"", "\033[32m",
- "\033[33m", "\033[36m", "\033[34m", "\033[1m",
- "\033[1;32m", "\033[1;33m"};
char *unread[2] = {"\33[37m \033[m", "\033[1;31m£¾\033[m"};
char priv, *mark, *favcolor, *brdname, *color, *class, *icon, *desc, *bm;
- short number;
+ short number, nuser;
if (yank_flag == 0 && get_data_number(get_current_fav()) == 0){
// brdnum > 0 ???
@@ -480,9 +489,7 @@ show_brdlist(int head, int clsflag, int newflag)
else
favcolor = "";
- color = colorset[(unsigned int)
- (B_BH(ptr)->title[1] + B_BH(ptr)->title[2] +
- B_BH(ptr)->title[3] + B_BH(ptr)->title[0]) & 07];
+ color = make_class_color(B_BH(ptr)->title);
/* board_description */
@@ -491,39 +498,37 @@ show_brdlist(int head, int clsflag, int newflag)
if (ptr->myattr & NBRD_LINE) {
number = -1;
- mark = "";
priv = ptr->myattr & NBRD_TAG ? 'D' : ' ',
favcolor = "";
brdname = "------------";
class = " ";
icon = " ";
desc = "------------------------------------------";
- bm = "";
}
else if (ptr->myattr & NBRD_FOLDER) {
number = get_data_number(get_fav_folder(getfolder(ptr->bid)));
- mark = "";
priv = ' ';
brdname = "MyFavFolder";
class = "¥Ø¿ý";
icon = "¡¼";
desc = get_folder_title(ptr->bid);
- bm = "";
}
else if (!HasPerm(B_BH(ptr))) {
number = -1;
- mark = "";
priv = ' ';
brdname = "Unknown??";
class = "ÁôªO";
icon = "¡H";
desc = "³o­ÓªO¬OÁôªO";
- bm = "";
}
else {
goto ugly_normal_case;
}
+ mark = "";
+ color = "";
+ bm = "";
+ nuser = 0;
}
else if (unlikely(B_BH(ptr)->brdattr & BRD_GROUPBOARD)) {
number = -1;
@@ -534,6 +539,7 @@ show_brdlist(int head, int clsflag, int newflag)
icon = B_BH(ptr)->title + 5;
desc = B_BH(ptr)->title + 7;
bm = B_BH(ptr)->BM;
+ nuser = 0;
}
else {
@@ -545,9 +551,10 @@ ugly_normal_case:
desc = B_BH(ptr)->title + 7;
bm = B_BH(ptr)->BM;
number = newflag ? (short)(B_TOTAL(ptr)) : head;
+ nuser = B_BH(ptr)->nuser;
}
- /* ugly */
+
if (!newflag)
prints("%5hd", head);
else {
@@ -559,25 +566,32 @@ ugly_normal_case:
prints("%c%2s" "%s%-13s\033[m" "%s%4.4s\033[0;37m " "%2.2s\033[m%-34.34s", priv, mark, favcolor, brdname, color, class, icon, desc);
+ if (strcmp(bm, "") == 0 ||
+ (unlikely(B_BH(ptr)->brdattr & BRD_GROUPBOARD))) {
+ outs(" ");
+ goto ignore_hot_status;
+ }
+
if (unlikely(B_BH(ptr)->brdattr & BRD_BAD))
outs(" X ");
- else if (unlikely(B_BH(ptr)->nuser >= 5000))
+ else if (unlikely(nuser >= 5000))
outs("\033[1;34mÃz!\033[m");
- else if (unlikely(B_BH(ptr)->nuser >= 2000))
+ else if (unlikely(nuser >= 2000))
outs("\033[1;31mÃz!\033[m");
- else if (unlikely(B_BH(ptr)->nuser >= 1000))
+ else if (unlikely(nuser >= 1000))
outs("\033[1mÃz!\033[m");
- else if (unlikely(B_BH(ptr)->nuser >= 100))
+ else if (unlikely(nuser >= 100))
outs("\033[1mHOT\033[m");
- else if (unlikely(B_BH(ptr)->nuser > 50))
+ else if (unlikely(nuser > 50))
prints("\033[1;31m%2d\033[m ", B_BH(ptr)->nuser);
- else if (B_BH(ptr)->nuser > 10)
+ else if (nuser > 10)
prints("\033[1;33m%2d\033[m ", B_BH(ptr)->nuser);
- else if (B_BH(ptr)->nuser > 0)
+ else if (nuser > 0)
prints("%2d ", B_BH(ptr)->nuser);
else
prints(" %c ", B_BH(ptr)->bvote ? 'V' : ' ');
+ignore_hot_status:
show_BM:
prints("%.*s\033[K", t_columns - 67, bm);