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
67 unsigned int sent[256];
70 /** Show the list of one or more list modes to a user.
71 * @param user User to send to.
72 * @param chan Channel whose lists to show.
73 * @param mode_sequence Mode letters to show the lists of.
75 void DisplayListModes(User* user, Channel* chan, const std::string& mode_sequence);
77 /** Show the current modes of a channel or a user to a user.
78 * @param user User to show the modes to.
79 * @param targetuser User whose modes to show. NULL if showing the modes of a channel.
80 * @param targetchannel Channel whose modes to show. NULL if showing the modes of a user.
82 void DisplayCurrentModes(User* user, User* targetuser, Channel* targetchannel);
85 /** Constructor for mode.
87 CommandMode(Module* parent);
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.
94 CmdResult Handle(const std::vector<std::string>& parameters, User* user);
96 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
101 class CommandNick : public SplitCommand
104 /** Constructor for nick.
106 CommandNick(Module* parent);
109 * @param parameters The parameters to the command
110 * @param user The user issuing the command
111 * @return A value from CmdResult to indicate command success or failure.
113 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
118 class CommandPart : public Command
121 MessageWrapper msgwrap;
123 /** Constructor for part.
125 CommandPart(Module* parent);
128 * @param parameters The parameters to the command
129 * @param user The user issuing the command
130 * @return A value from CmdResult to indicate command success or failure.
132 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
133 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
138 class CommandQuit : public Command
141 MessageWrapper msgwrap;
143 /** Constructor for quit.
145 CommandQuit(Module* parent);
148 * @param parameters The parameters to the command
149 * @param user The user issuing the command
150 * @return A value from CmdResult to indicate command success or failure.
152 CmdResult Handle(const std::vector<std::string>& parameters, User*user);
154 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
159 class CommandUser : public SplitCommand
162 /** Constructor for user.
164 CommandUser(Module* parent);
167 * @param parameters The parameters to the command
168 * @param user The user issuing the command
169 * @return A value from CmdResult to indicate command success or failure.
171 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
173 /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after an unregistered user
174 * successfully executes the USER or the NICK command.
175 * @param user User to inspect and possibly pass to the OnUserRegister hook
176 * @return CMD_FAILURE if OnUserRegister was called and it returned MOD_RES_DENY, CMD_SUCCESS in every other case
177 * (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
178 * a non-MOD_RES_DENY result).
180 static CmdResult CheckRegister(LocalUser* user);