14 #include <boost/range/algorithm/find_if.hpp>
17 #define ERR_NG LOG_STREAM(err, log_engine)
18 #define LOG_NG LOG_STREAM(info, log_engine)
36 const std::string::const_iterator j =
38 if (j == data.end())
return;
48 symbols[
"level"] =
level;
50 vgettext(
"Unknown debug level: '$level'.", symbols);
51 ERR_NG << msg << std::endl;
57 symbols[
"domain"] = domain;
59 vgettext(
"Unknown debug domain: '$domain'.", symbols);
60 ERR_NG << msg << std::endl;
66 symbols[
"level"] =
level;
67 symbols[
"domain"] = domain;
69 vgettext(
"Switched domain: '$domain' to level: '$level'.", symbols);
77 if (cmd ==
"muteall") {
80 else if (cmd ==
"query") {
83 else if (cmd ==
"ban" || cmd ==
"unban" || cmd ==
"kick"
84 || cmd ==
"mute" || cmd ==
"unmute") {
87 else if (cmd ==
"ping") {
88 data[cmd] = std::to_string(time(
nullptr));
90 else if (cmd ==
"green") {
91 data.
add_child(
"query")[
"type"] =
"lobbymsg @" + args;
93 else if (cmd ==
"red") {
94 data.
add_child(
"query")[
"type"] =
"lobbymsg #" + args;
96 else if (cmd ==
"yellow") {
97 data.
add_child(
"query")[
"type"] =
"lobbymsg <255,255,0>" + args;
99 else if (cmd ==
"report") {
100 data.
add_child(
"query")[
"type"] =
"report " + args;
102 else if (cmd ==
"join") {
103 data.
add_child(
"room_join")[
"room"] = args;
105 else if (cmd ==
"part") {
106 data.
add_child(
"room_part")[
"room"] = args;
113 if (message ==
"" || message ==
"/") {
116 bool is_command = (message[0] ==
'/');
117 bool quoted_command = (is_command && message[1] ==
' ');
123 else if (quoted_command) {
127 std::string cmd(message.begin() + 1, message.end());
139 cwhisper[
"receiver"] = receiver;
149 symbols[
"receiver"] = receiver;
156 symbols[
"sender"] = sender;
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="")
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
virtual void add_whisper_received(const std::string &sender, const std::string &message)
bool set_log_domain_severity(std::string const &name, int severity)
static UNUSEDNOWARN std::string _(const char *str)
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)
std::map< std::string, t_string > string_map
config & add_child(const std::string &key)
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 add_chat_message(const time_t &time, const std::string &speaker, int side, const std::string &message, MESSAGE_TYPE type=MESSAGE_PRIVATE)=0
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Handling of system events.
bool find(E event, F functor)
Tests whether an event handler is available.
virtual void add_whisper_sent(const std::string &receiver, const std::string &message)
Standard logging facilities (interface).
GLsizei GLenum GLuint GLuint GLsizei char * 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...
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 send_chat_room_message(const std::string &room, const std::string &message)
GLsizei const GLcharARB ** string