示例#1
0
文件: tui.c 项目: erichuang1994/fbbs
int tui_check_notice(const char *board_name)
{
	screen_move_clear(-1);
	prints("\033[m\xb2\xe9\xbf\xb4:");

	int replies, mentions;
	notice_count(&replies, &mentions);

	print_option("\xc8\xa1\xcf\xfb", NULL, 0, 0);
	print_option("\xbb\xd8\xb8\xb4", "\xc6\xaa", replies, 1);
	print_option("\xcc\xe1\xbc\xb0", "\xc6\xaa", mentions, 2);

	int choice = 0;
	if (replies)
		choice = 1;
	else if (mentions)
		choice = 2;
	prints(" [%d]: ", choice);

	char ans[2];
	int x, y;
	screen_coordinates(&x, &y);
	getdata(x, y, "", ans, sizeof(ans), true, true);

	if (*ans == '\0')
		*ans = '0' + choice;
	if (*ans == '1') {
		post_list_reply();
		brc_init(currentuser.userid, board_name);
		return FULLUPDATE;
	}
	if (*ans == '2') {
		post_list_mention();
		brc_init(currentuser.userid, board_name);
		return FULLUPDATE;
	}
	return MINIUPDATE;
}
示例#2
0
文件: tui.c 项目: fbbs/fbbs
int tui_check_notice(const char *board_name)
{
	int replies, mentions;
	notice_count(&replies, &mentions);

	int choice = 0;
	char buf[64], reply_string[16], mention_string[16];
	reply_string[0] = mention_string[0] = '\0';
	if (mentions > 0) {
		snprintf(mention_string, sizeof(mention_string), "%d篇", mentions);
		choice = 2;
	}
	if (replies) {
		snprintf(reply_string, sizeof(reply_string), "%d篇", replies);
		choice = 1;
	}
	snprintf(buf, sizeof(buf), "查看: 0) 取消 1) %s回复 2) %s提及 [%d]: ",
			reply_string, mention_string, choice);

	char ans[2];
	tui_input(-1, buf, ans, sizeof(ans));

	if (*ans == '\0')
		*ans = '0' + choice;
	if (*ans == '1') {
		post_list_reply();
		brc_init(currentuser.userid, board_name);
		return FULLUPDATE;
	}
	if (*ans == '2') {
		post_list_mention();
		brc_init(currentuser.userid, board_name);
		return FULLUPDATE;
	}
	return MINIUPDATE;
}