]> git.lizzy.rs Git - minetest.git/blob - src/servercommand.h
Improved server commands and added player permissions.
[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 class ServerCommand
51 {
52 public:
53
54         static std::wstring processCommand(ServerCommandContext *ctx);
55
56 private:
57
58         static void cmd_status(std::wostringstream &os,
59                         ServerCommandContext *ctx);
60         static void cmd_privs(std::wostringstream &os,
61                         ServerCommandContext *ctx);
62         static void cmd_grantrevoke(std::wostringstream &os,
63                         ServerCommandContext *ctx);
64         static void cmd_time(std::wostringstream &os,
65                         ServerCommandContext *ctx);
66         static void cmd_shutdown(std::wostringstream &os,
67                         ServerCommandContext *ctx);
68         static void cmd_setting(std::wostringstream &os,
69                         ServerCommandContext *ctx);
70         static void cmd_teleport(std::wostringstream &os,
71                         ServerCommandContext *ctx);
72 };
73
74 #endif
75
76