27 #define ERR_NG LOG_STREAM(err, log_engine) 28 #define LOG_NG LOG_STREAM(info, log_engine) 46 const std::string::const_iterator j =
47 std::find(data.begin(), data.end(),
' ');
48 if (j == data.end())
return;
49 const std::string
level(data.begin(), j);
50 const std::string domain(j + 1, data.end());
58 symbols[
"level"] =
level;
59 const std::string&
msg =
60 VGETTEXT(
"Unknown debug level: '$level'.", symbols);
67 symbols[
"domain"] = domain;
68 const std::string&
msg =
69 VGETTEXT(
"Unknown debug domain: '$domain'.", symbols);
76 symbols[
"level"] =
level;
77 symbols[
"domain"] = domain;
78 const std::string&
msg =
79 VGETTEXT(
"Switched domain: '$domain' to level: '$level'.", symbols);
87 if (cmd ==
"muteall") {
90 else if (cmd ==
"query") {
93 else if (cmd ==
"ban" || cmd ==
"unban" || cmd ==
"kick" 94 || cmd ==
"mute" || cmd ==
"unmute") {
97 else if (cmd ==
"ping") {
98 data[cmd] = std::to_string(std::time(
nullptr));
100 else if (cmd ==
"report") {
101 data.
add_child(
"query")[
"type"] =
"report " + args;
103 else if (cmd ==
"roll") {
104 data.
add_child(
"query")[
"type"] =
"roll " + args;
111 if (message.empty() || message ==
"/") {
114 bool is_command = (message[0] ==
'/');
115 bool quoted_command = (is_command && message[1] ==
' ');
121 else if (quoted_command) {
125 std::string cmd(message.begin() + 1, message.end());
137 cwhisper[
"receiver"] = receiver;
138 cwhisper[
"message"] = message;
140 data.
add_child(
"whisper", std::move(cwhisper));
147 symbols[
"receiver"] = receiver;
154 symbols[
"sender"] = sender;
159 const std::string& message)
163 cmsg[
"message"] = message;
165 data.
add_child(
"message", std::move(cmsg));
175 const std::string &speaker,
const std::string &message)
std::map< std::string, t_string > string_map
virtual void add_chat_room_message_received(const std::string &room, const std::string &speaker, const std::string &message)
virtual void send_to_server(const config &cfg)=0
virtual void add_chat_room_message_sent(const std::string &room, const std::string &message)
void send_command(const std::string &cmd, const std::string &args="")
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
static std::string _(const char *str)
virtual void add_whisper_received(const std::string &sender, const std::string &message)
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)
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.
bool set_log_domain_severity(const std::string &name, int severity)
config & add_child(config_key_type key)
Handling of system events.
virtual void add_whisper_sent(const std::string &receiver, const std::string &message)
Standard logging facilities (interface).
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...
static lg::log_domain log_engine("engine")
A config object defines a single node in a WML file, with access to child nodes.
int get_severity() const
Returns following values depending on the logger: error: 0 warn: 1 info: 2 debug: 3 See also the lg::...
virtual void send_chat_room_message(const std::string &room, 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