2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2017-2020 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2014-2015 Attila Molnar <attilamolnar@hush.com>
7 * This file is part of InspIRCd. InspIRCd is free software: you can
8 * redistribute it and/or modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation, version 2.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "modules/exemption.h"
29 void ShowTopic(LocalUser* user, Channel* chan);
36 /** Used to indicate who we announce invites to on a channel. */
39 /** Don't send invite announcements. */
42 /** Send invite announcements to all users. */
45 /** Send invite announcements to channel operators and higher. */
48 /** Send invite announcements to channel half-operators (if available) and higher. */
57 RPL_ENDOFBANLIST = 368,
63 class CommandInvite : public Command
65 Invite::APIImpl& invapi;
68 Invite::AnnounceState announceinvites;
70 /** Constructor for invite.
72 CommandInvite(Module* parent, Invite::APIImpl& invapiimpl);
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 Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
80 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
85 class CommandJoin : public SplitCommand
88 /** Constructor for join.
90 CommandJoin(Module* parent);
93 * @param parameters The parameters to the command
94 * @param user The user issuing the command
95 * @return A value from CmdResult to indicate command success or failure.
97 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
102 class CommandTopic : public SplitCommand
104 CheckExemption::EventProvider exemptionprov;
105 ChanModeReference secretmode;
106 ChanModeReference topiclockmode;
109 /** Constructor for topic.
111 CommandTopic(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 HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
123 class CommandNames : public SplitCommand
126 ChanModeReference secretmode;
127 ChanModeReference privatemode;
128 UserModeReference invisiblemode;
129 Events::ModuleEventProvider namesevprov;
132 /** Constructor for names.
134 CommandNames(Module* parent);
137 * @param parameters The parameters to the command
138 * @param user The user issuing the command
139 * @return A value from CmdResult to indicate command success or failure.
141 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
143 /** Spool the NAMES list for a given channel to the given user
144 * @param user User to spool the NAMES list to
145 * @param chan Channel whose nicklist to send
146 * @param show_invisible True to show invisible (+i) members to the user, false to omit them from the list
148 void SendNames(LocalUser* user, Channel* chan, bool show_invisible);
153 class CommandKick : public Command
156 /** Constructor for kick.
158 CommandKick(Module* parent);
161 * @param parameters The parameters to the command
162 * @param user The user issuing the command
163 * @return A value from CmdResult to indicate command success or failure.
165 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
166 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
171 class ModeChannelBan : public ListModeBase
174 ModeChannelBan(Module* Creator)
175 : ListModeBase(Creator, "ban", 'b', "End of channel ban list", RPL_BANLIST, RPL_ENDOFBANLIST, true)
183 class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
186 static const std::string::size_type maxkeylen;
187 ModeChannelKey(Module* Creator);
188 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
189 void SerializeParam(Channel* chan, const std::string* key, std::string& out) ;
190 ModeAction OnSet(User* source, Channel* chan, std::string& param) CXX11_OVERRIDE;
191 bool IsParameterSecret() CXX11_OVERRIDE;
196 class ModeChannelLimit : public ParamMode<ModeChannelLimit, LocalIntExt>
200 ModeChannelLimit(Module* Creator);
201 bool ResolveModeConflict(std::string& their_param, const std::string& our_param, Channel* channel) CXX11_OVERRIDE;
202 void SerializeParam(Channel* chan, intptr_t n, std::string& out);
203 ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE;
208 class ModeChannelOp : public PrefixMode
211 ModeChannelOp(Module* Creator)
212 : PrefixMode(Creator, "op", 'o', OP_VALUE, '@')
214 ranktoset = ranktounset = OP_VALUE;
220 class ModeChannelVoice : public PrefixMode
223 ModeChannelVoice(Module* Creator)
224 : PrefixMode(Creator, "voice", 'v', VOICE_VALUE, '+')
227 ranktoset = ranktounset = HALFOP_VALUE;