]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/coremods/core_oper/core_oper.h
bdb1ae9ee400e314c9621e36cbf66e9221f53002
[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(User* user, const Params& parameters) CXX11_OVERRIDE;
55 };
56
57 /** Handle /KILL.
58  */
59 class CommandKill : public Command
60 {
61         std::string lastuuid;
62         std::string killreason;
63         ClientProtocol::EventProvider protoev;
64
65  public:
66         /** Set to a non empty string to obfuscate nicknames prepended to a KILL. */
67         std::string hidenick;
68
69         /** Set to hide kills from clients of ulined servers in snotices. */
70         bool hideuline;
71
72         /** Constructor for kill.
73          */
74         CommandKill(Module* parent);
75
76         /** Handle command.
77          * @param user User issuing the command
78          * @param parameters Parameters to the command
79          * @return A value from CmdResult to indicate command success or failure.
80          */
81         CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
82         RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
83
84         void EncodeParameter(std::string& param, unsigned int index) CXX11_OVERRIDE;
85 };
86
87 /** Handle /OPER.
88  */
89 class CommandOper : public SplitCommand
90 {
91  public:
92         /** Constructor for oper.
93          */
94         CommandOper(Module* parent);
95
96         /** Handle command.
97          * @param user User issuing the command
98          * @param parameters Parameters to the command
99          * @return A value from CmdResult to indicate command success or failure.
100          */
101         CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
102 };
103
104 /** Handle /REHASH.
105  */
106 class CommandRehash : public Command
107 {
108  public:
109         /** Constructor for rehash.
110          */
111         CommandRehash(Module* parent);
112
113         /** Handle command.
114          * @param user User issuing the command
115          * @param parameters Parameters to the command
116          * @return A value from CmdResult to indicate command success or failure.
117          */
118         CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
119 };
120
121 /** Handle /RESTART
122  */
123 class CommandRestart : public Command
124 {
125  public:
126         /** Constructor for restart.
127          */
128         CommandRestart(Module* parent);
129
130         /** Handle command.
131          * @param user User issuing the command
132          * @param parameters Parameters to the command
133          * @return A value from CmdResult to indicate command success or failure.
134          */
135         CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
136 };