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
62 class CommandInvite : public Command
64 Invite::APIImpl& invapi;
67 Invite::AnnounceState announceinvites;
69 /** Constructor for invite.
71 CommandInvite(Module* parent, Invite::APIImpl& invapiimpl);
74 * @param parameters The parameters to the command
75 * @param user The user issuing the command
76 * @return A value from CmdResult to indicate command success or failure.
78 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
79 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
84 class CommandJoin : public SplitCommand
87 /** Constructor for join.
89 CommandJoin(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(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
101 class CommandTopic : public SplitCommand
103 CheckExemption::EventProvider exemptionprov;
104 ChanModeReference secretmode;
105 ChanModeReference topiclockmode;
108 /** Constructor for topic.
110 CommandTopic(Module* parent);
113 * @param parameters The parameters to the command
114 * @param user The user issuing the command
115 * @return A value from CmdResult to indicate command success or failure.
117 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
122 class CommandNames : public SplitCommand
125 ChanModeReference secretmode;
126 ChanModeReference privatemode;
127 UserModeReference invisiblemode;
128 Events::ModuleEventProvider namesevprov;
131 /** Constructor for names.
133 CommandNames(Module* parent);
136 * @param parameters The parameters to the command
137 * @param user The user issuing the command
138 * @return A value from CmdResult to indicate command success or failure.
140 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
142 /** Spool the NAMES list for a given channel to the given user
143 * @param user User to spool the NAMES list to
144 * @param chan Channel whose nicklist to send
145 * @param show_invisible True to show invisible (+i) members to the user, false to omit them from the list
147 void SendNames(LocalUser* user, Channel* chan, bool show_invisible);
152 class CommandKick : public Command
155 /** Constructor for kick.
157 CommandKick(Module* parent);
160 * @param parameters The parameters to the command
161 * @param user The user issuing the command
162 * @return A value from CmdResult to indicate command success or failure.
164 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
165 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
170 class ModeChannelBan : public ListModeBase
173 ModeChannelBan(Module* Creator)
174 : ListModeBase(Creator, "ban", 'b', "End of channel ban list", RPL_BANLIST, RPL_ENDOFBANLIST, true)
182 class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
185 static const std::string::size_type maxkeylen;
186 ModeChannelKey(Module* Creator);
187 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
188 void SerializeParam(Channel* chan, const std::string* key, std::string& out) ;
189 ModeAction OnSet(User* source, Channel* chan, std::string& param) CXX11_OVERRIDE;
190 bool IsParameterSecret() CXX11_OVERRIDE;
195 class ModeChannelLimit : public ParamMode<ModeChannelLimit, LocalIntExt>
199 ModeChannelLimit(Module* Creator);
200 bool ResolveModeConflict(std::string& their_param, const std::string& our_param, Channel* channel) CXX11_OVERRIDE;
201 void SerializeParam(Channel* chan, intptr_t n, std::string& out);
202 ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE;
207 class ModeChannelOp : public PrefixMode
210 ModeChannelOp(Module* Creator)
211 : PrefixMode(Creator, "op", 'o', OP_VALUE, '@')
213 ranktoset = ranktounset = OP_VALUE;
219 class ModeChannelVoice : public PrefixMode
222 ModeChannelVoice(Module* Creator)
223 : PrefixMode(Creator, "voice", 'v', VOICE_VALUE, '+')
226 ranktoset = ranktounset = HALFOP_VALUE;