コード例 #1
0
ファイル: main.c プロジェクト: erichuang1994/fbbs
void start_client(void)
{
	extern char currmaildir[];

	initialize_mdb();
#ifndef ENABLE_SSH
	initialize_db();
#endif

	initialize_convert_env();
	system_init();

	if (setjmp(byebye)) {
		system_abort();
	}

	strlcpy(BoardName, BBSNAME, sizeof(BoardName));

	if (login_query() == -1) {
		terminal_flush();
		sleep(3);
		exit(1);
	}
#ifndef ENABLE_SSH
	screen_negotiate_size();
#endif // ENABLE_SSH
	screen_init(0);

	user_login();

	setmdir(currmaildir, currentuser.userid);
	RMSG = NA;
	screen_clear();
	editor_restore();
#ifdef TALK_LOG
	tlog_recover();
#endif

	if (strcmp(currentuser.userid, "guest")) {
		if (check_maxmail())
			pressanykey();
		screen_move(9, 0);
		screen_clrtobot();
		if (!DEFINE(DEF_NOLOGINSEND))
			if (session_visible())
				login_msg();
		screen_clear();
		set_numofsig();
	}

	active_board_init(false);
	fill_date();

	if (DEFINE(DEF_LOGFRIEND)
			&& session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)) > 0)
		show_online_followings();

	menu_load("menu.img");
	while (1) {
		if (DEFINE(DEF_NORMALSCR))
			menu_loop("TOPMENU");
		else
			menu_loop("TOPMENU2");
		Goodbye();
	}
}
コード例 #2
0
ファイル: xyz.c プロジェクト: fbbs/fbbs
//修改用户的档案
void x_edits() {
	char ans[7], buf[STRLEN];
	int ch, num, confirm;

	const char *e_file[] = {
		"plans", "signatures", "notes", "logout", NULL
	};

	//% "个人说明档", "签名档", "自己的备忘录", "离站的画面",
	//% "底部流动信息"
	const char *explain_file[] = {
		"\xb8\xf6\xc8\xcb\xcb\xb5\xc3\xf7\xb5\xb5",
		"\xc7\xa9\xc3\xfb\xb5\xb5",
		"\xd7\xd4\xbc\xba\xb5\xc4\xb1\xb8\xcd\xfc\xc2\xbc",
		"\xc0\xeb\xd5\xbe\xb5\xc4\xbb\xad\xc3\xe6",
		"\xb5\xd7\xb2\xbf\xc1\xf7\xb6\xaf\xd0\xc5\xcf\xa2",
		NULL
	};

	set_user_status(ST_GMENU);
	screen_clear();
	screen_move(1, 0);
	//% prints("编修个人档案\n\n");
	prints("\xb1\xe0\xd0\xde\xb8\xf6\xc8\xcb\xb5\xb5\xb0\xb8\n\n");
	for (num = 0; e_file[num] != NULL && explain_file[num] != NULL; num++) {
		prints("[%d] %s\n", num + 1, explain_file[num]);
	}
	//% prints("[%d] 都不想改\n", num + 1);
	prints("[%d] \xb6\xbc\xb2\xbb\xcf\xeb\xb8\xc4\n", num + 1);

	//% getdata(num + 5, 0, "您要编修哪一项个人档案: ", ans, 2, DOECHO, YEA);
	getdata(num + 5, 0, "\xc4\xfa\xd2\xaa\xb1\xe0\xd0\xde\xc4\xc4\xd2\xbb\xcf\xee\xb8\xf6\xc8\xcb\xb5\xb5\xb0\xb8: ", ans, 2, DOECHO, YEA);
	if (ans[0] - '0' <= 0 || ans[0] - '0' > num || ans[0] == '\n'
			|| ans[0] == '\0')
		return;

	ch = ans[0] - '0' - 1;
	setuserfile(genbuf, e_file[ch]);
	screen_move(3, 0);
	screen_clrtobot();
	//% sprintf(buf, "(E)编辑 (D)删除 %s? [E]: ", explain_file[ch]);
	sprintf(buf, "(E)\xb1\xe0\xbc\xad (D)\xc9\xbe\xb3\xfd %s? [E]: ", explain_file[ch]);
	getdata(3, 0, buf, ans, 2, DOECHO, YEA);
	if (ans[0] == 'D' || ans[0] == 'd') {
		//% confirm = askyn("您确定要删除这个档案", NA, NA);
		confirm = askyn("\xc4\xfa\xc8\xb7\xb6\xa8\xd2\xaa\xc9\xbe\xb3\xfd\xd5\xe2\xb8\xf6\xb5\xb5\xb0\xb8", NA, NA);
		if (confirm != 1) {
			screen_move(5, 0);
			//% prints("取消删除行动\n");
			prints("\xc8\xa1\xcf\xfb\xc9\xbe\xb3\xfd\xd0\xd0\xb6\xaf\n");
			pressreturn();
			screen_clear();
			return;
		}
		unlink(genbuf);
		screen_move(5, 0);
		//% prints("%s 已删除\n", explain_file[ch]);
		prints("%s \xd2\xd1\xc9\xbe\xb3\xfd\n", explain_file[ch]);
		sprintf(buf, "delete %s", explain_file[ch]);
		report(buf, currentuser.userid);
		pressreturn();
		screen_clear();
		return;
	}
	set_user_status(ST_EDITUFILE);
	editor_e status = editor(genbuf, false, false, true, NULL);
	screen_clear();
	if (status == EDITOR_SAVE) {
		//% prints("%s 更新过\n", explain_file[ch]);
		prints("%s \xb8\xfc\xd0\xc2\xb9\xfd\n", explain_file[ch]);
		sprintf(buf, "edit %s", explain_file[ch]);
		if (!strcmp(e_file[ch], "signatures")) {
			set_numofsig();
			//% prints("系统重新设定以及读入您的签名档...");
			prints("\xcf\xb5\xcd\xb3\xd6\xd8\xd0\xc2\xc9\xe8\xb6\xa8\xd2\xd4\xbc\xb0\xb6\xc1\xc8\xeb\xc4\xfa\xb5\xc4\xc7\xa9\xc3\xfb\xb5\xb5...");
		}
		report(buf, currentuser.userid);
	} else {
		//% prints("%s 取消修改\n", explain_file[ch]);
		prints("%s \xc8\xa1\xcf\xfb\xd0\xde\xb8\xc4\n", explain_file[ch]);
	}
	pressreturn();
}