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);
67 class CommandNick : public SplitCommand
70 /** Constructor for nick.
72 CommandNick(Module* parent);
75 * @param parameters The parameters to the command
76 * @param user The user issuing the command
77 * @return A value from CmdResult to indicate command success or failure.
79 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
84 class CommandPart : public Command
87 MessageWrapper msgwrap;
89 /** Constructor for part.
91 CommandPart(Module* parent);
94 * @param parameters The parameters to the command
95 * @param user The user issuing the command
96 * @return A value from CmdResult to indicate command success or failure.
98 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
99 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
104 class CommandQuit : public Command
107 MessageWrapper msgwrap;
109 /** Constructor for quit.
111 CommandQuit(Module* parent);
114 * @param parameters The parameters to the command
115 * @param user The user issuing the command
116 * @return A value from CmdResult to indicate command success or failure.
118 CmdResult Handle(const std::vector<std::string>& parameters, User*user);
120 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
125 class CommandUser : public SplitCommand
128 /** Constructor for user.
130 CommandUser(Module* parent);
133 * @param parameters The parameters to the command
134 * @param user The user issuing the command
135 * @return A value from CmdResult to indicate command success or failure.
137 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
139 /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after an unregistered user
140 * successfully executes the USER or the NICK command.
141 * @param user User to inspect and possibly pass to the OnUserRegister hook
142 * @return CMD_FAILURE if OnUserRegister was called and it returned MOD_RES_DENY, CMD_SUCCESS in every other case
143 * (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
144 * a non-MOD_RES_DENY result).
146 static CmdResult CheckRegister(LocalUser* user);