add chat filter proxy option
This commit is contained in:
+2
-1
@@ -301,6 +301,7 @@ ProxyServer::LinkedSession::LinkedSession(
|
|||||||
guild_card_number(0),
|
guild_card_number(0),
|
||||||
newserv_client_config(newserv_client_config),
|
newserv_client_config(newserv_client_config),
|
||||||
suppress_newserv_commands(true),
|
suppress_newserv_commands(true),
|
||||||
|
enable_chat_filter(true),
|
||||||
lobby_players(12),
|
lobby_players(12),
|
||||||
lobby_client_id(0) {
|
lobby_client_id(0) {
|
||||||
memset(this->remote_client_config_data, 0, 0x20);
|
memset(this->remote_client_config_data, 0, 0x20);
|
||||||
@@ -484,7 +485,7 @@ void ProxyServer::LinkedSession::on_client_input() {
|
|||||||
log(WARNING, "[ProxyServer/%08" PRIX32 "] Chat message appears to be a server command; dropping it",
|
log(WARNING, "[ProxyServer/%08" PRIX32 "] Chat message appears to be a server command; dropping it",
|
||||||
this->license->serial_number);
|
this->license->serial_number);
|
||||||
should_forward = false;
|
should_forward = false;
|
||||||
} else {
|
} else if (this->enable_chat_filter) {
|
||||||
// Turn all $ into \t and all # into \n
|
// Turn all $ into \t and all # into \n
|
||||||
add_color_inplace(data.data() + 8, data.size() - 8);
|
add_color_inplace(data.data() + 8, data.size() - 8);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
uint8_t remote_client_config_data[0x20];
|
uint8_t remote_client_config_data[0x20];
|
||||||
ClientConfig newserv_client_config;
|
ClientConfig newserv_client_config;
|
||||||
bool suppress_newserv_commands;
|
bool suppress_newserv_commands;
|
||||||
|
bool enable_chat_filter;
|
||||||
|
|
||||||
struct LobbyPlayer {
|
struct LobbyPlayer {
|
||||||
uint32_t guild_card_number;
|
uint32_t guild_card_number;
|
||||||
|
|||||||
+20
-3
@@ -97,15 +97,21 @@ Proxy commands (these will only work when exactly one client is connected):\n\
|
|||||||
Send a lobby event update to yourself.\n\
|
Send a lobby event update to yourself.\n\
|
||||||
warp <area-id>\n\
|
warp <area-id>\n\
|
||||||
Send yourself to a specific area.\n\
|
Send yourself to a specific area.\n\
|
||||||
|
set-chat-filter <on|off>\n\
|
||||||
|
Enable or disable chat filtering (enabled by default). Chat filtering\n\
|
||||||
|
applies newserv\'s standard character replacements to chat messages (for\n\
|
||||||
|
example, $ becomes a tab character and # becomes a newline).\n\
|
||||||
set-chat-safety <on|off>\n\
|
set-chat-safety <on|off>\n\
|
||||||
Enable or disable chat safety (enabled by default). When chat safety is on,\n\
|
Enable or disable chat safety (enabled by default). When chat safety is on,\n\
|
||||||
all chat messages that begin with a $ are not sent to the remote server.\n\
|
all chat messages that begin with a $ are not sent to the remote server.\n\
|
||||||
This can prevent embarrassing situations if the remote server isn\'t a\n\
|
This can prevent embarrassing situations if the remote server isn\'t a\n\
|
||||||
newserv instance and you have newserv commands in your chat shortcuts.\n\
|
newserv instance and you have newserv commands in your chat shortcuts.\n\
|
||||||
set-save-files <on|off>\n\
|
set-save-files <on|off>\n\
|
||||||
Enable or disable saving of game files. When this is on, any file that the\n\
|
Enable or disable saving of game files (disabled by default). When this is\n\
|
||||||
remote server sends to the client will be saved to the current directory.\n\
|
on, any file that the remote server sends to the client will be saved to\n\
|
||||||
This includes data like quests, Episode 3 card definitions, and GBA games.\n\
|
the current directory. This includes data like quests, Episode 3 card\n\
|
||||||
|
definitions, and GBA games. Unlike other proxy commands, this command\n\
|
||||||
|
affects all proxy sessions.\n\
|
||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
@@ -317,6 +323,17 @@ Proxy commands (these will only work when exactly one client is connected):\n\
|
|||||||
|
|
||||||
session->send_to_end(data, true);
|
session->send_to_end(data, true);
|
||||||
|
|
||||||
|
} else if (command_name == "set-chat-filter") {
|
||||||
|
auto session = this->get_proxy_session();
|
||||||
|
|
||||||
|
if (command_args == "on") {
|
||||||
|
session->enable_chat_filter = true;
|
||||||
|
} else if (command_args == "off") {
|
||||||
|
session->enable_chat_filter = false;
|
||||||
|
} else {
|
||||||
|
throw invalid_argument("argument must be \"on\" or \"off\"");
|
||||||
|
}
|
||||||
|
|
||||||
} else if (command_name == "set-chat-safety") {
|
} else if (command_name == "set-chat-safety") {
|
||||||
auto session = this->get_proxy_session();
|
auto session = this->get_proxy_session();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user