]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/coremods/core_oper/core_oper.h
3b3dfd4b26f5adf425e8cd51c441f04049c8a2ea
[user/henk/code/inspircd.git] / src / coremods / core_oper / core_oper.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
5  *
6  * This file is part of InspIRCd.  InspIRCd is free software: you can
7  * redistribute it and/or modify it under the terms of the GNU General Public
8  * License as published by the Free Software Foundation, version 2.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19
20 #pragma once
21
22 #include "inspircd.h"
23
24 namespace DieRestart
25 {
26         /** Checks a die or restart password
27          * @param user The user executing /DIE or /RESTART
28          * @param inputpass The password given by the user
29          * @param confkey The name of the key in the power tag containing the correct password
30          * @return True if the given password was correct, false if it was not
31          */
32         bool CheckPass(User* user, const std::string& inputpass, const char* confkey);
33 }
34
35 /** Handle /DIE.
36  */
37 class CommandDie : public Command
38 {
39  public:
40         /** Constructor for die.
41          */
42         CommandDie(Module* parent);
43
44         /** Handle command.
45          * @param parameters The parameters to the command
46          * @param user The user issuing the command
47          * @return A value from CmdResult to indicate command success or failure.
48          */
49         CmdResult Handle(const std::vector<std::string>& parameters, User* user);
50 };
51
52 /** Handle /KILL.
53  */
54 class CommandKill : public Command
55 {
56         std::string lastuuid;
57         std::string killreason;
58
59  public:
60         /** Constructor for kill.
61          */
62         CommandKill(Module* parent);
63
64         /** Handle command.
65          * @param parameters The parameters to the command
66          * @param user The user issuing the command
67          * @return A value from CmdResult to indicate command success or failure.
68          */
69         CmdResult Handle(const std::vector<std::string>& parameters, User* user);
70         RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
71
72         void EncodeParameter(std::string& param, int index);
73 };
74
75 /** Handle /OPER.
76  */
77 class CommandOper : public SplitCommand
78 {
79  public:
80         /** Constructor for oper.
81          */
82         CommandOper(Module* parent);
83
84         /** Handle command.
85          * @param parameters The parameters to the command
86          * @param user The user issuing the command
87          * @return A value from CmdResult to indicate command success or failure.
88          */
89         CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
90 };
91
92 /** Handle /REHASH.
93  */
94 class CommandRehash : public Command
95 {
96  public:
97         /** Constructor for rehash.
98          */
99         CommandRehash(Module* parent);
100
101         /** Handle command.
102          * @param parameters The parameters to the command
103          * @param user The user issuing the command
104          * @return A value from CmdResult to indicate command success or failure.
105          */
106         CmdResult Handle(const std::vector<std::string>& parameters, User *user);
107 };
108
109 /** Handle /RESTART
110  */
111 class CommandRestart : public Command
112 {
113  public:
114         /** Constructor for restart.
115          */
116         CommandRestart(Module* parent);
117
118         /** Handle command.
119          * @param parameters The parameters to the command
120          * @param user The user issuing the command
121          * @return A value from CmdResult to indicate command success or failure.
122          */
123         CmdResult Handle(const std::vector<std::string>& parameters, User* user);
124 };