blob: 421f3b66e5c29442b1841c7ef049336f225dbb00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef SERVERCOMMAND_HEADER
#define SERVERCOMMAND_HEADER
#include <vector>
#include <sstream>
#include "common_irrlicht.h"
#include "player.h"
#include "server.h"
#define SEND_TO_SENDER (1<<0)
#define SEND_TO_OTHERS (1<<1)
#define SEND_NO_PREFIX (1<<2)
struct ServerCommandContext
{
std::vector<std::wstring> parms;
std::wstring paramstring;
Server* server;
ServerEnvironment *env;
Player* player;
// Effective privs for the player, which may be different to their
// stored ones - e.g. if they are named in the config as an admin.
u64 privs;
u32 flags;
ServerCommandContext(
std::vector<std::wstring> parms,
std::wstring paramstring,
Server* server,
ServerEnvironment *env,
Player* player,
u64 privs)
: parms(parms), paramstring(paramstring),
server(server), env(env), player(player), privs(privs)
{
}
};
// Process a command sent from a client. The environment and connection
// should be locked when this is called.
// Returns a response message, to be dealt with according to the flags set
// in the context.
std::wstring processServerCommand(ServerCommandContext *ctx);
#endif
|