]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/coremods/core_oper/core_oper.h
Merge tag 'v2.0.25' into master.
[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         /** Send an ERROR to unregistered users and a NOTICE to all registered local users
35          * @param message Message to send
36          */
37         void SendError(const std::string& message);
38 }
39
40 /** Handle /DIE.
41  */
42 class CommandDie : public Command
43 {
44  public:
45         /** Constructor for die.
46          */
47         CommandDie(Module* parent);
48
49         /** Handle command.
50          * @param parameters The parameters to the command
51          * @param user The user issuing the command
52          * @return A value from CmdResult to indicate command success or failure.
53          */
54         CmdResult Handle(const std::vector<std::string>& parameters, User* user);
55 };
56
57 /** Handle /KILL.
58  */
59 class CommandKill : public Command
60 {
61         std::string lastuuid;
62         std::string killreason;
63
64  public:
65         /** Constructor for kill.
66          */
67         CommandKill(Module* parent);
68
69         /** Handle command.
70          * @param parameters The parameters to the command
71          * @param user The user issuing the command
72          * @return A value from CmdResult to indicate command success or failure.
73          */
74         CmdResult Handle(const std::vector<std::string>& parameters, User* user);
75         RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
76
77         void EncodeParameter(std::string& param, int index);
78 };
79
80 /** Handle /OPER.
81  */
82 class CommandOper : public SplitCommand
83 {
84  public:
85         /** Constructor for oper.
86          */
87         CommandOper(Module* parent);
88
89         /** Handle command.
90          * @param parameters The parameters to the command
91          * @param user The user issuing the command
92          * @return A value from CmdResult to indicate command success or failure.
93          */
94         CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
95 };
96
97 /** Handle /REHASH.
98  */
99 class CommandRehash : public Command
100 {
101  public:
102         /** Constructor for rehash.
103          */
104         CommandRehash(Module* parent);
105
106         /** Handle command.
107          * @param parameters The parameters to the command
108          * @param user The user issuing the command
109          * @return A value from CmdResult to indicate command success or failure.
110          */
111         CmdResult Handle(const std::vector<std::string>& parameters, User *user);
112 };
113
114 /** Handle /RESTART
115  */
116 class CommandRestart : public Command
117 {
118  public:
119         /** Constructor for restart.
120          */
121         CommandRestart(Module* parent);
122
123         /** Handle command.
124          * @param parameters The parameters to the command
125          * @param user The user issuing the command
126          * @return A value from CmdResult to indicate command success or failure.
127          */
128         CmdResult Handle(const std::vector<std::string>& parameters, User* user);
129 };