1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style CYCLE command. */
20 class CommandCycle : public Command
23 CommandCycle(Module* Creator) : Command(Creator,"CYCLE", 1)
25 Penalty = 3; syntax = "<channel> :[reason]";
26 TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
29 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
31 Channel* channel = ServerInstance->FindChan(parameters[0]);
32 std::string reason = ConvToStr("Cycling");
34 if (parameters.size() > 1)
36 /* reason provided, use it */
37 reason = reason + ": " + parameters[1];
42 user->WriteNumeric(403, "%s %s :No such channel", user->nick.c_str(), parameters[0].c_str());
46 if (channel->HasUser(user))
49 * technically, this is only ever sent locally, but pays to be safe ;p
53 if (channel->GetPrefixValue(user) < VOICE_VALUE && channel->IsBanned(user))
55 /* banned, boned. drop the message. */
56 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** You may not cycle, as you are banned on channel " + channel->name);
60 channel->PartUser(user, reason);
62 Channel::JoinUser(user, parameters[0].c_str(), true, "", false, ServerInstance->Time());
69 user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick.c_str(), channel->name.c_str());
77 class ModuleCycle : public Module
84 ServerInstance->AddCommand(&cmd);
87 virtual ~ModuleCycle()
91 virtual Version GetVersion()
93 return Version("Provides support for unreal-style CYCLE command.", VF_VENDOR);
98 MODULE_INIT(ModuleCycle)