Server commands without classes
[oweals/minetest.git] / src / servercommand.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #ifndef SERVERCOMMAND_HEADER
22 #define SERVERCOMMAND_HEADER
23
24 #include <vector>
25 #include <sstream>
26 #include "common_irrlicht.h"
27 #include "player.h"
28 #include "server.h"
29
30 struct ServerCommandContext
31 {
32
33         std::vector<std::wstring> parms;
34         Server* server;
35         ServerEnvironment *env;
36         Player* player;
37         u32 flags;
38
39         ServerCommandContext(
40                 std::vector<std::wstring> parms,
41                 Server* server,
42                 ServerEnvironment *env,
43                 Player* player)
44                 : parms(parms), server(server), env(env), player(player)
45         {
46         }
47
48 };
49
50 // Process a command sent from a client. The environment and connection
51 // should be locked when this is called.
52 // Returns a response message, to be dealt with according to the flags set
53 // in the context.
54 std::wstring processServerCommand(ServerCommandContext *ctx);
55
56 #endif
57
58