expand proxy options, catch invalid commands from server
This commit is contained in:
+12
-6
@@ -200,12 +200,18 @@ static void server_command_dbgid(shared_ptr<ServerState>, shared_ptr<Lobby>,
|
|||||||
|
|
||||||
static void server_command_proxygc(shared_ptr<ServerState>, shared_ptr<Lobby>,
|
static void server_command_proxygc(shared_ptr<ServerState>, shared_ptr<Lobby>,
|
||||||
shared_ptr<Client> c, const std::u16string& args) {
|
shared_ptr<Client> c, const std::u16string& args) {
|
||||||
uint32_t proxy_remote_guild_card_number = stoll(encode_sjis(args), nullptr, 0);
|
if (args.empty()) {
|
||||||
client_options_cache.replace(
|
client_options_cache.delete_key(
|
||||||
string_printf("proxy_remote_guild_card_number:%" PRIX32, c->license->serial_number),
|
string_printf("proxy_remote_guild_card_number:%" PRIX32, c->license->serial_number));
|
||||||
string_printf("%08" PRIu32, proxy_remote_guild_card_number));
|
send_text_message(c, u"Proxy remote Guild\nCard number cleared");
|
||||||
send_text_message_printf(c, "Proxy remote Guild\nCard number set to\n$C6%" PRIu32,
|
} else {
|
||||||
proxy_remote_guild_card_number);
|
uint32_t proxy_remote_guild_card_number = stoll(encode_sjis(args), nullptr, 0);
|
||||||
|
client_options_cache.replace(
|
||||||
|
string_printf("proxy_remote_guild_card_number:%" PRIX32, c->license->serial_number),
|
||||||
|
string_printf("%08" PRIu32, proxy_remote_guild_card_number));
|
||||||
|
send_text_message_printf(c, "Proxy remote Guild\nCard number set to\n$C6%" PRIu32,
|
||||||
|
proxy_remote_guild_card_number);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void proxy_command_proxygc(shared_ptr<ServerState>,
|
static void proxy_command_proxygc(shared_ptr<ServerState>,
|
||||||
|
|||||||
+425
-1707
File diff suppressed because it is too large
Load Diff
@@ -663,6 +663,12 @@ void ProxyServer::LinkedSession::on_error(Channel& ch, short events) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProxyServer::LinkedSession::clear_lobby_players(size_t num_slots) {
|
||||||
|
this->lobby_players.clear();
|
||||||
|
this->lobby_players.resize(num_slots);
|
||||||
|
this->log.info("Cleared lobby players");
|
||||||
|
}
|
||||||
|
|
||||||
void ProxyServer::LinkedSession::send_to_game_server(const char* error_message) {
|
void ProxyServer::LinkedSession::send_to_game_server(const char* error_message) {
|
||||||
// Delete all the other players
|
// Delete all the other players
|
||||||
for (size_t x = 0; x < this->lobby_players.size(); x++) {
|
for (size_t x = 0; x < this->lobby_players.size(); x++) {
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ public:
|
|||||||
static void on_error(Channel& ch, short events);
|
static void on_error(Channel& ch, short events);
|
||||||
void on_timeout();
|
void on_timeout();
|
||||||
|
|
||||||
|
void clear_lobby_players(size_t num_slots);
|
||||||
|
|
||||||
void send_to_game_server(const char* error_message = nullptr);
|
void send_to_game_server(const char* error_message = nullptr);
|
||||||
void disconnect();
|
void disconnect();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user