24 #define ERR_NG LOG_STREAM(err, log_engine)
25 #define LOG_NG LOG_STREAM(info, log_engine)
43 const std::string::const_iterator j =
45 if (j ==
data.end())
return;
47 const std::string domain(j + 1,
data.end());
55 symbols[
"level"] =
level;
56 const std::string&
msg =
57 VGETTEXT(
"Unknown debug level: '$level'.", symbols);
64 symbols[
"domain"] = domain;
65 const std::string&
msg =
66 VGETTEXT(
"Unknown debug domain: '$domain'.", symbols);
73 symbols[
"level"] =
level;
74 symbols[
"domain"] = domain;
75 const std::string&
msg =
76 VGETTEXT(
"Switched domain: '$domain' to level: '$level'.", symbols);
84 if (cmd ==
"muteall") {
87 else if (cmd ==
"query") {
88 data.add_child(cmd)[
"type"] = args;
90 else if (cmd ==
"ban" || cmd ==
"unban" || cmd ==
"kick"
91 || cmd ==
"mute" || cmd ==
"unmute") {
92 data.add_child(cmd)[
"username"] = args;
94 else if (cmd ==
"ping") {
95 data[cmd] = std::to_string(std::time(
nullptr));
97 else if (cmd ==
"report") {
98 data.add_child(
"query")[
"type"] =
"report " + args;
100 else if (cmd ==
"roll") {
101 data.add_child(
"query")[
"type"] =
"roll " + args;
108 if (message.empty() || message ==
"/") {
111 bool is_command = (message[0] ==
'/');
112 bool quoted_command = (is_command && message[1] ==
' ');
118 else if (quoted_command) {
122 std::string cmd(message.begin() + 1, message.end());
134 cwhisper[
"receiver"] = receiver;
135 cwhisper[
"message"] = message;
137 data.add_child(
"whisper", std::move(cwhisper));
144 symbols[
"receiver"] = receiver;
151 symbols[
"sender"] = sender;
156 const std::string& message)
160 cmsg[
"message"] = message;
162 data.add_child(
"message", std::move(cmsg));
172 const std::string &speaker,
const std::string &message)
static lg::log_domain log_engine("engine")
A config object defines a single node in a WML file, with access to child nodes.
virtual void add_chat_room_message_received(const std::string &room, const std::string &speaker, const std::string &message)
virtual void send_chat_room_message(const std::string &room, const std::string &message)
virtual void add_chat_room_message_sent(const std::string &room, const std::string &message)
virtual void user_relation_changed(const std::string &name)
Called when a processed command results in a relation (friend/ignore) change for a user whose name is...
virtual void add_whisper_received(const std::string &sender, const std::string &message)
virtual void add_whisper_sent(const std::string &receiver, const std::string &message)
void do_speak(const std::string &message, bool allies_only=false)
void change_logging(const std::string &data)
Change the log level of a log domain.
virtual void send_chat_message(const std::string &message, bool allies_only=false)=0
virtual void send_whisper(const std::string &receiver, const std::string &message)
virtual void add_chat_message(const std::time_t &time, const std::string &speaker, int side, const std::string &message, MESSAGE_TYPE type=MESSAGE_PRIVATE)=0
virtual void send_to_server(const config &cfg)=0
void send_command(const std::string &cmd, const std::string &args="")
void dispatch(std::string cmd)
severity get_severity() const
static std::string _(const char *str)
Standard logging facilities (interface).
Handling of system events.
bool set_log_domain_severity(const std::string &name, severity severity)
std::map< std::string, t_string > string_map
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")