Optimize headers
[oweals/minetest.git] / src / servercommand.h
1 /*
2 Part of Minetest-c55
3 Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef SERVERCOMMAND_HEADER
20 #define SERVERCOMMAND_HEADER
21
22 #include <vector>
23 #include <sstream>
24 #include "irrlichttypes.h"
25 #include "player.h"
26 #include "server.h"
27
28 #define SEND_TO_SENDER (1<<0)
29 #define SEND_TO_OTHERS (1<<1)
30 #define SEND_NO_PREFIX (1<<2)
31
32 struct ServerCommandContext
33 {
34         std::vector<std::wstring> parms;
35         std::wstring paramstring;
36         Server* server;
37         ServerEnvironment *env;
38         Player* player;
39         u32 flags;
40
41         ServerCommandContext(
42                 std::vector<std::wstring> parms,
43                 std::wstring paramstring,
44                 Server* server,
45                 ServerEnvironment *env,
46                 Player* player)
47                 : parms(parms), paramstring(paramstring),
48                 server(server), env(env), player(player)
49         {
50         }
51
52 };
53
54 // Process a command sent from a client. The environment and connection
55 // should be locked when this is called.
56 // Returns a response message, to be dealt with according to the flags set
57 // in the context.
58 std::wstring processServerCommand(ServerCommandContext *ctx);
59
60 #endif
61
62