2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
5 * Copyright (C) 2013, 2018 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2012-2014, 2016 Attila Molnar <attilamolnar@hush.com>
7 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
8 * Copyright (C) 2010 Craig Edwards <brain@inspircd.org>
9 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
10 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
11 * Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
12 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
13 * Copyright (C) 2007 John Brooks <special@inspircd.org>
15 * This file is part of InspIRCd. InspIRCd is free software: you can
16 * redistribute it and/or modify it under the terms of the GNU General Public
17 * License as published by the Free Software Foundation, version 2.
19 * This program is distributed in the hope that it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 class CommandCycle : public SplitCommand
36 CommandCycle(Module* Creator)
37 : SplitCommand(Creator, "CYCLE", 1)
40 syntax = "<channel> [:<reason>]";
43 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE
45 Channel* channel = ServerInstance->FindChan(parameters[0]);
46 std::string reason = "Cycling";
48 if (parameters.size() > 1)
50 /* reason provided, use it */
51 reason = reason + ": " + parameters[1];
56 user->WriteNumeric(Numerics::NoSuchChannel(parameters[0]));
60 if (channel->HasUser(user))
62 if (channel->GetPrefixValue(user) < VOICE_VALUE && channel->IsBanned(user))
64 // User is banned, send an error and don't cycle them
65 user->WriteNotice("*** You may not cycle, as you are banned on channel " + channel->name);
69 channel->PartUser(user, reason);
70 Channel::JoinUser(user, parameters[0], true);
76 user->WriteNumeric(ERR_NOTONCHANNEL, channel->name, "You're not on that channel");
84 class ModuleCycle : public Module
94 Version GetVersion() CXX11_OVERRIDE
96 return Version("Allows channel members to part and rejoin a channel without needing to worry about channel modes such as +i (inviteonly) which might prevent rejoining.", VF_VENDOR);
100 MODULE_INIT(ModuleCycle)