rewrite chat command system

This commit is contained in:
Martin Michelsen
2025-01-12 16:27:02 -08:00
parent b028532db3
commit 9033fb6a5d
10 changed files with 2615 additions and 2622 deletions
+2609 -2607
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -10,5 +10,5 @@
#include "ProxyServer.hh"
#include "ServerState.hh"
void on_chat_command(std::shared_ptr<Client> c, const std::string& text);
void on_chat_command(std::shared_ptr<ProxyServer::LinkedSession> ses, const std::string& text);
void on_chat_command(std::shared_ptr<Client> c, const std::string& text, bool check_permissions);
void on_chat_command(std::shared_ptr<ProxyServer::LinkedSession> ses, const std::string& text, bool check_permissions);
-1
View File
@@ -1214,7 +1214,6 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
// 19 = View Battle waiting room
// 1A = TCard00_Select (debug battle setup menu)
// 1B = nothing (softlocks at black screen)
// TCard00_Select is accessible on newserv with the $ep3battledebug command.
/* 000A */ uint8_t environment_number;
// This field specifies how many of the camera_zone_maps are used.
-2
View File
@@ -4,7 +4,6 @@
using namespace std;
phosg::PrefixedLogger ax_messages_log("[$ax message] ", phosg::LogLevel::USE_DEFAULT);
phosg::PrefixedLogger channel_exceptions_log("[Channel] ", phosg::LogLevel::USE_DEFAULT);
phosg::PrefixedLogger client_log("", phosg::LogLevel::USE_DEFAULT);
phosg::PrefixedLogger command_data_log("[Commands] ", phosg::LogLevel::USE_DEFAULT);
@@ -30,7 +29,6 @@ static void set_log_level_from_json(
}
void set_log_levels_from_json(const phosg::JSON& json) {
set_log_level_from_json(ax_messages_log, json, "AXMessages");
set_log_level_from_json(channel_exceptions_log, json, "ChannelExceptions");
set_log_level_from_json(client_log, json, "Clients");
set_log_level_from_json(command_data_log, json, "CommandData");
-1
View File
@@ -3,7 +3,6 @@
#include <phosg/JSON.hh>
#include <phosg/Strings.hh>
extern phosg::PrefixedLogger ax_messages_log;
extern phosg::PrefixedLogger channel_exceptions_log;
extern phosg::PrefixedLogger client_log;
extern phosg::PrefixedLogger command_data_log;
+1 -1
View File
@@ -1954,7 +1954,7 @@ static HandlerResult C_06(shared_ptr<ProxyServer::LinkedSession> ses, uint16_t,
send_chat_message_from_client(ses->server_channel, text.substr(1), private_flags);
return HandlerResult::Type::SUPPRESS;
} else {
on_chat_command(ses, text);
on_chat_command(ses, text, true);
return HandlerResult::Type::SUPPRESS;
}
+1 -1
View File
@@ -3538,7 +3538,7 @@ static void on_06(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
if (text[1] == command_sentinel) {
text = text.substr(1);
} else {
on_chat_command(c, text);
on_chat_command(c, text, true);
return;
}
}
+2 -2
View File
@@ -908,7 +908,7 @@ ShellCommand c_cc(
}
if (ses.get()) {
on_chat_command(ses, args.args);
on_chat_command(ses, args.args, false);
} else {
shared_ptr<Client> c;
if (args.session_name.empty()) {
@@ -925,7 +925,7 @@ ShellCommand c_cc(
}
if (c) {
on_chat_command(c, args.args);
on_chat_command(c, args.args, false);
} else {
throw runtime_error("no client available");
}