示例#1
0
/*
 * @brief Shuts down the client console.
 */
void Cl_ShutdownConsole(void) {

	Con_RemoveConsole(&cl_console);

	file_t *file = Fs_OpenWrite("history");
	if (file) {
		Con_WriteHistory(&cl_console, file);
		Fs_Close(file);
	} else {
		Com_Warn("Couldn't write history\n");
	}

	Cmd_Remove("cl_toggle_console");
	Cmd_Remove("cl_message_mode");
	Cmd_Remove("cl_message_mode_2");

	Com_Print("Client console shutdown\n");
}
示例#2
0
/**
 * @brief
 */
void Sv_ShutdownConsole(void) {

	if (!dedicated->value) {
		return;
	}

	endwin();

	Con_RemoveConsole(&sv_console);

	file_t *file = Fs_OpenWrite("history");
	if (file) {
		Con_WriteHistory(&sv_console, file);
		Fs_Close(file);
	} else {
		Com_Warn("Couldn't write history\n");
	}

#if defined(_WIN32)
	FreeConsole();
#endif
}
示例#3
0
文件: sv_main.c 项目: chrisnew/quetoo
/*
 * @brief A client issued an rcon command. Shift down the remaining args and
 * redirect all output to the invoking client.
 */
static void Sv_Rcon_f(void) {

	const _Bool auth = Sv_RconAuthenticate();

	const char *addr = Net_NetaddrToString(&net_from);

	// first print to the server console
	if (auth)
		Com_Print("Rcon from %s:\n%s\n", addr, net_message.data + 4);
	else
		Com_Print("Bad rcon from %s:\n%s\n", addr, net_message.data + 4);

	// then redirect the remaining output back to the client

	console_t rcon = { .Append = Sv_Rcon_Print };
	sv_rcon_buffer[0] = '\0';

	Con_AddConsole(&rcon);

	if (auth) {
		char cmd[MAX_STRING_CHARS];
		cmd[0] = '\0';

		for (int32_t i = 2; i < Cmd_Argc(); i++) {
			g_strlcat(cmd, Cmd_Argv(i), sizeof(cmd));
			g_strlcat(cmd, " ", sizeof(cmd));
		}

		Cmd_ExecuteString(cmd);
	} else {
		Com_Print("Bad rcon_password\n");
	}

	Netchan_OutOfBandPrint(NS_UDP_SERVER, &net_from, "print\n%s", sv_rcon_buffer);

	Con_RemoveConsole(&rcon);
}