1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 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 (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CYCLE", 0, 1, false, 3)
25 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 /* XXX in the future, this may move to a static Channel method (the delete.) -- w00t */
61 if (!channel->PartUser(user, reason))
64 Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), true, "", false, ServerInstance->Time());
71 user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick.c_str(), channel->name.c_str());
79 class ModuleCycle : public Module
83 ModuleCycle(InspIRCd* Me)
84 : Module(Me), cmd(Me, this)
86 ServerInstance->AddCommand(&cmd);
89 virtual ~ModuleCycle()
93 virtual Version GetVersion()
95 return Version("$Id$", VF_VENDOR, API_VERSION);
100 MODULE_INIT(ModuleCycle)