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
3
#include "
map_command_handler.hpp
"
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
:
12
typedef
map_command_handler<chat_command_handler>
map
;
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
();
21
void
do_network_send_req_arg
();
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
52
std::string
get_flags_description
()
const
{
53
return
_
(
"(A) — admin command"
);
54
}
55
56
std::string
get_command_flags_description
(
57
const
map_command_handler<chat_command_handler>::command
&
c
)
const
58
{
59
if
(c.has_flag(
'A'
)) {
60
return
std::string
(
" "
) +
_
(
"(admin only)"
);
61
}
62
else
{
63
return
""
;
64
}
65
}
66
67
bool
is_enabled
(
const
map_command_handler<chat_command_handler>::command
&
c
)
const
;
68
69
void
print
(
const
std::string
& title,
const
std::string
&
message
);
70
71
void
init_map
()
72
{
73
set_cmd_prefix
(
"/"
);
74
register_command
(
"query"
, &
chat_command_handler::do_network_send
,
75
_
(
"Send a query to the server. Without arguments the server"
76
" should tell you the available commands."
));
77
register_alias
(
"query"
,
"q"
);
78
register_command
(
"ban"
, &
chat_command_handler::do_network_send_req_arg
,
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>"
));
81
register_command
(
"unban"
, &
chat_command_handler::do_network_send_req_arg
,
82
_
(
"Unban a user. He does not have to be in the game but on"
83
" the server."
),
_
(
"<nickname>"
));
84
register_command
(
"kick"
, &
chat_command_handler::do_network_send_req_arg
,
85
_
(
"Kick a player or observer."
),
_
(
"<nickname>"
));
86
register_command
(
"mute"
, &
chat_command_handler::do_network_send
,
87
_
(
"Mute an observer. Without an argument displays the mute status."
),
_
(
"<nickname>"
));
88
register_command
(
"unmute"
, &
chat_command_handler::do_network_send
,
89
_
(
"Unmute an observer. Without an argument unmutes everyone."
),
_
(
"<nickname>"
));
90
register_command
(
"muteall"
, &
chat_command_handler::do_network_send
,
91
_
(
"Mute/Unmute all observers. (toggles)"
),
""
);
92
register_command
(
"ping"
, &
chat_command_handler::do_network_send
,
93
""
);
94
register_command
(
"green"
, &
chat_command_handler::do_network_send_req_arg
,
95
""
,
""
,
"A"
);
96
register_command
(
"red"
, &
chat_command_handler::do_network_send_req_arg
,
97
""
,
""
,
"A"
);
98
register_command
(
"yellow"
, &
chat_command_handler::do_network_send_req_arg
,
99
""
,
""
,
"A"
);
100
register_command
(
"report"
, &
chat_command_handler::do_network_send_req_arg
,
101
_
(
"Report abuse, rule violations, etc. to the server moderators. "
102
"Make sure to mention relevant nicknames, etc."
),
""
);
103
register_alias
(
"report"
,
"adminmsg"
);
// deprecated
104
register_command
(
"emote"
, &
chat_command_handler::do_emote
,
105
_
(
"Send an emotion or personal action in chat."
),
_
(
"<message>"
));
106
register_alias
(
"emote"
,
"me"
);
107
register_command
(
"whisper"
, &
chat_command_handler::do_whisper
,
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"
);
113
register_command
(
"log"
, &
chat_command_handler::do_log
,
114
_
(
"Change the log level of a log domain."
),
_
(
"<level> <domain>"
));
115
register_command
(
"ignore"
, &
chat_command_handler::do_ignore
,
116
_
(
"Add a nickname to your ignores list."
),
_
(
"<nickname>"
));
117
register_command
(
"friend"
, &
chat_command_handler::do_friend
,
118
_
(
"Add a nickname to your friends list."
),
_
(
"<nickname>"
));
119
register_command
(
"remove"
, &
chat_command_handler::do_remove
,
120
_
(
"Remove a nickname from your ignores or friends list."
),
_
(
"<nickname>"
));
121
register_command
(
"version"
, &
chat_command_handler::do_version
,
122
_
(
"Display version information."
));
123
register_command
(
"register"
, &
chat_command_handler::do_register
,
124
_
(
"Register your nickname"
),
_
(
"<password> <email (optional)>"
));
125
register_command
(
"drop"
, &
chat_command_handler::do_drop
,
126
_
(
"Drop your nickname."
));
127
register_command
(
"set"
, &
chat_command_handler::do_set
,
128
_
(
"Update details for your nickname. For possible details see '/details'."
),
129
_
(
"<detail> <value>"
));
130
register_command
(
"info"
, &
chat_command_handler::do_info
,
131
_
(
"Request information about a nickname."
),
_
(
"<nickname>"
));
132
register_command
(
"details"
, &
chat_command_handler::do_details
,
133
_
(
"Request a list of details you can set for your registered nickname."
));
134
register_command
(
"join"
, &
chat_command_handler::do_network_send_req_arg
,
135
_
(
"Join a room."
),
_
(
"<room>"
));
136
register_alias
(
"join"
,
"j"
);
137
register_command
(
"part"
, &
chat_command_handler::do_network_send_req_arg
,
138
_
(
"Part a room."
),
_
(
"<room>"
));
139
register_command
(
"names"
, &
chat_command_handler::do_room_query
,
140
_
(
"List room members."
),
_
(
"<room>"
));
141
register_command
(
"rooms"
, &
chat_command_handler::do_room_query_noarg
,
142
_
(
"List available rooms."
));
143
register_command
(
"room"
, &
chat_command_handler::do_chanmsg
,
144
_
(
"Room message."
),
_
(
"<room> <msg>"
));
145
register_command
(
"room_query"
, &
chat_command_handler::do_gen_room_query
,
146
_
(
"Room query."
),
_
(
"<room> <type> [value]"
));
147
register_alias
(
"room_query"
,
"rq"
);
148
}
149
private
:
150
chat_handler
&
chat_handler_
;
151
bool
allies_only_
;
152
};
153
154
}
events::chat_command_handler::do_info
void do_info()
Request information about a user from the server.
Definition:
chat_command_handler.cpp:203
events::chat_command_handler
Definition:
chat_command_handler.hpp:9
events::chat_command_handler::init_map
void init_map()
Definition:
chat_command_handler.hpp:71
events::chat_command_handler::get_flags_description
std::string get_flags_description() const
Definition:
chat_command_handler.hpp:52
gettext.hpp
map_command_handler.hpp
events::chat_command_handler::do_details
void do_details()
Request a list of details that can be set for a username as these might vary depending on the configu...
Definition:
chat_command_handler.cpp:217
events::chat_handler
Definition:
chat_events.hpp:26
events::chat_command_handler::do_chanmsg
void do_chanmsg()
Definition:
chat_command_handler.cpp:75
events::chat_command_handler::do_remove
void do_remove()
Definition:
chat_command_handler.cpp:126
events::chat_command_handler::do_friend
void do_friend()
Definition:
chat_command_handler.cpp:107
events::chat_command_handler::do_drop
void do_drop()
Ask the server do drop the currently used (and registered) nick.
Definition:
chat_command_handler.cpp:174
c
const GLfloat * c
Definition:
glew.h:12741
events::chat_command_handler::is_enabled
bool is_enabled(const map_command_handler< chat_command_handler >::command &c) const
Definition:
chat_command_handler.cpp:11
events::chat_command_handler::do_ignore
void do_ignore()
Definition:
chat_command_handler.cpp:88
events::chat_command_handler::do_whisper
void do_whisper()
Definition:
chat_command_handler.cpp:67
events::chat_command_handler::print
void print(const std::string &title, const std::string &message)
Definition:
chat_command_handler.cpp:16
events::chat_command_handler::do_emote
void do_emote()
Definition:
chat_command_handler.cpp:22
events::map_command_handler
Definition:
map_command_handler.hpp:118
events::chat_command_handler::do_network_send_req_arg
void do_network_send_req_arg()
Definition:
chat_command_handler.cpp:32
_
static UNUSEDNOWARN std::string _(const char *str)
Definition:
gettext.hpp:82
events::chat_command_handler::map
map_command_handler< chat_command_handler > map
Definition:
chat_command_handler.hpp:12
events::chat_command_handler::do_set
void do_set()
Update details for the currently used username.
Definition:
chat_command_handler.cpp:185
events::map_command_handler< chat_command_handler >::register_alias
virtual void register_alias(const std::string &to_cmd, const std::string &cmd)
Definition:
map_command_handler.hpp:363
events::chat_command_handler::do_log
void do_log()
Definition:
chat_command_handler.cpp:83
events::chat_command_handler::get_command_flags_description
std::string get_command_flags_description(const map_command_handler< chat_command_handler >::command &c) const
Definition:
chat_command_handler.hpp:56
events::chat_command_handler::do_network_send
void do_network_send()
Definition:
chat_command_handler.cpp:27
events::chat_command_handler::do_version
void do_version()
Definition:
chat_command_handler.cpp:144
events::map_command_handler< chat_command_handler >::set_cmd_prefix
static void set_cmd_prefix(std::string value)
Definition:
map_command_handler.hpp:345
events
Handling of system events.
Definition:
manager.hpp:42
events::chat_command_handler::do_register
void do_register()
Ask the server to register the currently used nick.
Definition:
chat_command_handler.cpp:148
message
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition:
glew.h:2499
events::chat_command_handler::do_gen_room_query
void do_gen_room_query()
Definition:
chat_command_handler.cpp:56
events::chat_command_handler::chat_command_handler
chat_command_handler(chat_handler &chathandler, bool allies_only)
Definition:
chat_command_handler.hpp:13
events::chat_command_handler::chat_handler_
chat_handler & chat_handler_
Definition:
chat_command_handler.hpp:150
events::map_command_handler< chat_command_handler >::register_command
virtual void register_command(const std::string &cmd, command_handler h, const std::string &help="", const std::string &usage="", const std::string &flags="")
Definition:
map_command_handler.hpp:349
events::chat_command_handler::allies_only_
bool allies_only_
Definition:
chat_command_handler.hpp:151
events::chat_command_handler::do_display
void do_display()
Definition:
chat_command_handler.cpp:137
string
GLsizei const GLcharARB ** string
Definition:
glew.h:4503
events::chat_command_handler::do_room_query_noarg
void do_room_query_noarg()
Definition:
chat_command_handler.cpp:38
events::chat_command_handler::do_room_query
void do_room_query()
Definition:
chat_command_handler.cpp:46
Generated by
1.8.8