2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
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.
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
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/>.
32 * Wrap the given message according to the config rules
33 * @param message The message to wrap
34 * @param out String where the result is placed
36 void Wrap(const std::string& message, std::string& out);
39 * Read the settings from the given config keys (options block)
40 * @param prefixname Name of the config key to read the prefix from
41 * @param suffixname Name of the config key to read the suffix from
42 * @param fixedname Name of the config key to read the fixed string string from.
43 * If this key has a non-empty value, all messages will be replaced with it.
45 void ReadConfig(const char* prefixname, const char* suffixname, const char* fixedname);
50 class CommandAway : public Command
53 /** Constructor for away.
55 CommandAway(Module* parent);
57 * @param parameters The parameters to the command
58 * @param user The user issuing the command
59 * @return A value from CmdResult to indicate command success or failure.
61 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
62 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
65 class CommandMode : public Command
68 /** Constructor for mode.
70 CommandMode(Module* parent);
73 * @param parameters The parameters to the command
74 * @param user The user issuing the command
75 * @return A value from CmdResult to indicate command success or failure.
77 CmdResult Handle(const std::vector<std::string>& parameters, User* user);
79 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
84 class CommandNick : public SplitCommand
87 /** Constructor for nick.
89 CommandNick(Module* parent);
92 * @param parameters The parameters to the command
93 * @param user The user issuing the command
94 * @return A value from CmdResult to indicate command success or failure.
96 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
101 class CommandPart : public Command
104 MessageWrapper msgwrap;
106 /** Constructor for part.
108 CommandPart(Module* parent);
111 * @param parameters The parameters to the command
112 * @param user The user issuing the command
113 * @return A value from CmdResult to indicate command success or failure.
115 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
116 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
121 class CommandQuit : public Command
124 MessageWrapper msgwrap;
126 /** Constructor for quit.
128 CommandQuit(Module* parent);
131 * @param parameters The parameters to the command
132 * @param user The user issuing the command
133 * @return A value from CmdResult to indicate command success or failure.
135 CmdResult Handle(const std::vector<std::string>& parameters, User*user);
137 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
142 class CommandUser : public SplitCommand
145 /** Constructor for user.
147 CommandUser(Module* parent);
150 * @param parameters The parameters to the command
151 * @param user The user issuing the command
152 * @return A value from CmdResult to indicate command success or failure.
154 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
156 /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after an unregistered user
157 * successfully executes the USER or the NICK command.
158 * @param user User to inspect and possibly pass to the OnUserRegister hook
159 * @return CMD_FAILURE if OnUserRegister was called and it returned MOD_RES_DENY, CMD_SUCCESS in every other case
160 * (i.e. if the hook wasn't fired because the user still needs to send NICK/USER or if it was fired and finished with
161 * a non-MOD_RES_DENY result).
163 static CmdResult CheckRegister(LocalUser* user);