The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
chat_command_handler.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include "gettext.hpp"
5 
6 namespace events {
7  class chat_handler;
8 //command handler for chat /commands
9 class chat_command_handler : public map_command_handler<chat_command_handler>
10 {
11 public:
13  chat_command_handler(chat_handler& chathandler, bool allies_only)
14  : map(), chat_handler_(chathandler), allies_only_(allies_only)
15  {
16  }
17 
18 protected:
19  void do_emote();
20  void do_network_send();
22  void do_room_query();
23  void do_room_query_noarg();
24  void do_gen_room_query();
25  void do_whisper();
26  void do_chanmsg();
27  void do_log();
28  void do_ignore();
29  void do_friend();
30  void do_remove();
31  void do_display();
32  void do_version();
33 
34  /** Ask the server to register the currently used nick. */
35  void do_register();
36 
37  /** Ask the server do drop the currently used (and registered) nick. */
38  void do_drop();
39 
40  /** Update details for the currently used username. */
41  void do_set();
42 
43  /** Request information about a user from the server. */
44  void do_info();
45 
46  /**
47  * Request a list of details that can be set for a username
48  * as these might vary depending on the configuration of the server.
49  */
50  void do_details();
51 
53  return _("(A) — admin command");
54  }
55 
58  {
59  if (c.has_flag('A')) {
60  return std::string(" ") + _("(admin only)");
61  }
62  else {
63  return "";
64  }
65  }
66 
68 
69  void print(const std::string& title, const std::string& message);
70 
71  void init_map()
72  {
73  set_cmd_prefix("/");
75  _("Send a query to the server. Without arguments the server"
76  " should tell you the available commands."));
77  register_alias("query", "q");
79  _("Ban and kick a player or observer. If he is not in the"
80  " game but on the server he will only be banned."), _("<nickname>"));
82  _("Unban a user. He does not have to be in the game but on"
83  " the server."), _("<nickname>"));
85  _("Kick a player or observer."), _("<nickname>"));
87  _("Mute an observer. Without an argument displays the mute status."), _("<nickname>"));
89  _("Unmute an observer. Without an argument unmutes everyone."), _("<nickname>"));
91  _("Mute/Unmute all observers. (toggles)"), "");
93  "");
95  "", "", "A");
97  "", "", "A");
99  "", "", "A");
101  _("Report abuse, rule violations, etc. to the server moderators. "
102  "Make sure to mention relevant nicknames, etc."), "");
103  register_alias("report", "adminmsg"); // deprecated
105  _("Send an emotion or personal action in chat."), _("<message>"));
106  register_alias("emote", "me");
108  _("Sends a private message. "
109  "You cannot send private messages to players in a running game you observe or play in."),
110  _("<nickname> <message>"));
111  register_alias("whisper", "msg");
112  register_alias("whisper", "m");
114  _("Change the log level of a log domain."), _("<level> <domain>"));
116  _("Add a nickname to your ignores list."), _("<nickname>"));
118  _("Add a nickname to your friends list."), _("<nickname>"));
120  _("Remove a nickname from your ignores or friends list."), _("<nickname>"));
122  _("Display version information."));
124  _("Register your nickname"), _("<password> <email (optional)>"));
126  _("Drop your nickname."));
128  _("Update details for your nickname. For possible details see '/details'."),
129  _("<detail> <value>"));
131  _("Request information about a nickname."), _("<nickname>"));
133  _("Request a list of details you can set for your registered nickname."));
135  _("Join a room."), _("<room>"));
136  register_alias("join", "j");
138  _("Part a room."), _("<room>"));
140  _("List room members."), _("<room>"));
142  _("List available rooms."));
144  _("Room message."), _("<room> <msg>"));
146  _("Room query."), _("<room> <type> [value]"));
147  register_alias("room_query", "rq");
148  }
149 private:
152 };
153 
154 }
void do_info()
Request information about a user from the server.
std::string get_flags_description() const
void do_details()
Request a list of details that can be set for a username as these might vary depending on the configu...
void do_drop()
Ask the server do drop the currently used (and registered) nick.
const GLfloat * c
Definition: glew.h:12741
bool is_enabled(const map_command_handler< chat_command_handler >::command &c) const
void print(const std::string &title, const std::string &message)
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:82
map_command_handler< chat_command_handler > map
void do_set()
Update details for the currently used username.
virtual void register_alias(const std::string &to_cmd, const std::string &cmd)
std::string get_command_flags_description(const map_command_handler< chat_command_handler >::command &c) const
Handling of system events.
Definition: manager.hpp:42
void do_register()
Ask the server to register the currently used nick.
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499
chat_command_handler(chat_handler &chathandler, bool allies_only)
virtual void register_command(const std::string &cmd, command_handler h, const std::string &help="", const std::string &usage="", const std::string &flags="")
GLsizei const GLcharARB ** string
Definition: glew.h:4503