Ejemplo n.º 1
0
Archivo: tui.c Proyecto: fbbs/fbbs
void tui_update_status_line(void)
{
	extern time_t login_start_time; //main.c

	char date[STRLEN];

	screen_move_clear(-1);

	if (!DEFINE(DEF_ENDLINE))
		return;

	fb_time_t now = fb_time();
	int cur_sec = now % 10;

	if (cur_sec < 5) {
		strlcpy(date, format_time(now, TIME_FORMAT_UTF8_ZH), sizeof(date));
	} else {
		if (resolve_boards() >= 0)
			convert_g2u(brdshm->date, date);
		else
			date[0] = '\0';
	}

	if (cur_sec >= 5 && is_birth(&currentuser)) {
		screen_printf("\033[0;1;33;44m[\033[36m                      "
				"啦啦~~生日快乐!记得要请客哟 :P"
				"                       \033[33m]\033[m");
	} else {
		int stay = (now - login_start_time) / 60;
		char stay_str[20];
		describe_stay(stay, stay_str, sizeof(stay_str));

		char notice[128];
		notice_string(notice, sizeof(notice));
		int notice_width = screen_display_width(notice, true);

		screen_printf("\033[1;44;33m[\033[36m%29s\033[33m]"
			"[\033[36m%5d\033[33m人\033[36m%3d\033[33m友]",
			date, session_count_online(),
			session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)));
		// 剩下35列
		if (notice_width) {
			int space = 33 - notice_width;
			if (space > 0)
				tui_repeat_char(' ', space);
			screen_printf("[\033[%d;36m%s\033[m\033[1;33;44m]\033[m",
					_suppress_notice ? 1 : 5, notice);
		} else {
			int space = 27 - strlen(currentuser.userid);
			tui_repeat_char(' ', space);
			prints("[\033[36m%s\033[33m]%s\033[m", currentuser.userid,
					stay_str);
		}
	}
}
Ejemplo n.º 2
0
void tui_update_status_line(void)
{
	extern time_t login_start_time; //main.c

	char date[STRLEN];

	screen_move_clear(-1);

	if (!DEFINE(DEF_ENDLINE))
		return;

	fb_time_t now = fb_time();
	int cur_sec = now % 10;

	if (cur_sec < 5) {
		strlcpy(date, format_time(now, TIME_FORMAT_ZH), sizeof(date));
	} else {
		if (resolve_boards() >= 0)
			strlcpy(date, brdshm->date, 30);
		else
			date[0] = '\0';
	}

	if (cur_sec >= 5 && is_birth(&currentuser)) {
		//% "啦啦~~,生日快乐!   记得要请客哟 :P"
		prints("\033[0;1;44;33m[\033[36m                     "
				"\xc0\xb2\xc0\xb2\xa1\xab\xa1\xab\xa3\xac\xc9\xfa\xc8\xd5"
				"\xbf\xec\xc0\xd6!   \xbc\xc7\xb5\xc3\xd2\xaa\xc7\xeb"
				"\xbf\xcd\xd3\xb4 :P                   \033[33m]\033[m");
	} else {
		int stay = (now - login_start_time) / 60;
		char stay_str[20];
		describe_stay(stay, stay_str, sizeof(stay_str));

		char notice[128];
		notice_string(notice, sizeof(notice));
		int notice_len = strlen(notice);

		prints(	"\033[1;44;33m[\033[36m%29s\033[33m]"
			//% "人 友"
			"[\033[36m%5d\033[33m\xc8\xcb\033[36m%3d\033[33m\xd3\xd1]",
			date, session_count_online(),
			session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)));
		if (notice_len) {
			int space = 25 - notice_len;
			if (space > 0) {
				tui_repeat_char(' ', space);
				prints("[\033[%d;36m%s\033[m\033[1;33;44m]%s\033[m",
						_suppress_notice ? 1 : 5, notice, stay_str);
			} else {
				space += 6;
				if (space > 0)
					tui_repeat_char(' ', space);
				prints("[\033[%d;36m%s\033[m\033[1;33;44m]\033[m",
						_suppress_notice ? 1 : 5, notice);
			}
		} else {
			int space = 25 - strlen(currentuser.userid);
			tui_repeat_char(' ', space);
			prints("[\033[36m%s\033[33m]%s\033[m", currentuser.userid,
					stay_str);
		}
	}
}