2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
5 * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
6 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
7 * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
9 * This file is part of InspIRCd. InspIRCd is free software: you can
10 * redistribute it and/or modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation, version 2.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include "modules/exemption.h"
31 void ShowTopic(LocalUser* user, Channel* chan);
38 /** Used to indicate who we announce invites to on a channel. */
41 /** Don't send invite announcements. */
44 /** Send invite announcements to all users. */
47 /** Send invite announcements to channel operators and higher. */
50 /** Send invite announcements to channel half-operators (if available) and higher. */
57 class CommandInvite : public Command
59 Invite::APIImpl& invapi;
62 Invite::AnnounceState announceinvites;
64 /** Constructor for invite.
66 CommandInvite(Module* parent, Invite::APIImpl& invapiimpl);
69 * @param parameters The parameters to the command
70 * @param user The user issuing the command
71 * @return A value from CmdResult to indicate command success or failure.
73 CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE;
74 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE;
79 class CommandJoin : public SplitCommand
82 /** Constructor for join.
84 CommandJoin(Module* parent);
87 * @param parameters The parameters to the command
88 * @param user The user issuing the command
89 * @return A value from CmdResult to indicate command success or failure.
91 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user) CXX11_OVERRIDE;
96 class CommandTopic : public SplitCommand
98 CheckExemption::EventProvider exemptionprov;
99 ChanModeReference secretmode;
100 ChanModeReference topiclockmode;
103 /** Constructor for topic.
105 CommandTopic(Module* parent);
108 * @param parameters The parameters to the command
109 * @param user The user issuing the command
110 * @return A value from CmdResult to indicate command success or failure.
112 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user) CXX11_OVERRIDE;
117 class CommandNames : public SplitCommand
119 ChanModeReference secretmode;
120 ChanModeReference privatemode;
121 UserModeReference invisiblemode;
124 /** Constructor for names.
126 CommandNames(Module* parent);
129 * @param parameters The parameters to the command
130 * @param user The user issuing the command
131 * @return A value from CmdResult to indicate command success or failure.
133 CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user) CXX11_OVERRIDE;
135 /** Spool the NAMES list for a given channel to the given user
136 * @param user User to spool the NAMES list to
137 * @param chan Channel whose nicklist to send
138 * @param show_invisible True to show invisible (+i) members to the user, false to omit them from the list
140 void SendNames(LocalUser* user, Channel* chan, bool show_invisible);
145 class CommandKick : public Command
148 /** Constructor for kick.
150 CommandKick(Module* parent);
153 * @param parameters The parameters to the command
154 * @param user The user issuing the command
155 * @return A value from CmdResult to indicate command success or failure.
157 CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE;
158 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE;
163 class ModeChannelBan : public ListModeBase
166 ModeChannelBan(Module* Creator)
167 : ListModeBase(Creator, "ban", 'b', "End of channel ban list", 367, 368, true, "maxbans")
174 class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
177 static const std::string::size_type maxkeylen;
178 ModeChannelKey(Module* Creator);
179 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
180 void SerializeParam(Channel* chan, const std::string* key, std::string& out) ;
181 ModeAction OnSet(User* source, Channel* chan, std::string& param) CXX11_OVERRIDE;
186 class ModeChannelLimit : public ParamMode<ModeChannelLimit, LocalIntExt>
190 ModeChannelLimit(Module* Creator);
191 bool ResolveModeConflict(std::string& their_param, const std::string& our_param, Channel* channel) CXX11_OVERRIDE;
192 void SerializeParam(Channel* chan, intptr_t n, std::string& out);
193 ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE;
198 class ModeChannelOp : public PrefixMode
201 ModeChannelOp(Module* Creator)
202 : PrefixMode(Creator, "op", 'o', OP_VALUE, '@')
204 ranktoset = ranktounset = OP_VALUE;
210 class ModeChannelVoice : public PrefixMode
213 ModeChannelVoice(Module* Creator)
214 : PrefixMode(Creator, "voice", 'v', VOICE_VALUE, '+')
217 ranktoset = ranktounset = HALFOP_VALUE;