1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/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) : Command(Instance,"CYCLE", 0, 1, false, 3)
25 this->source = "m_cycle.so";
26 syntax = "<channel> :[reason]";
27 TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
30 CmdResult Handle (const char* const* parameters, int pcnt, User *user)
32 Channel* channel = ServerInstance->FindChan(parameters[0]);
33 std::string reason = ConvToStr("Cycling");
37 /* reason provided, use it */
38 reason = reason + ": " + parameters[1];
43 user->WriteNumeric(403, "%s %s :No such channel", user->nick, parameters[0]);
47 if (channel->HasUser(user))
50 * technically, this is only ever sent locally, but pays to be safe ;p
54 if (channel->GetStatus(user) < STATUS_VOICE && channel->IsBanned(user))
56 /* banned, boned. drop the message. */
57 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** You may not cycle, as you are banned on channel " + channel->name);
61 /* XXX in the future, this may move to a static Channel method (the delete.) -- w00t */
62 if (!channel->PartUser(user, reason.c_str()))
65 Channel::JoinUser(ServerInstance, user, parameters[0], true, "", false, ServerInstance->Time());
72 user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick, channel->name);
80 class ModuleCycle : public Module
82 CommandCycle* mycommand;
84 ModuleCycle(InspIRCd* Me)
88 mycommand = new CommandCycle(ServerInstance);
89 ServerInstance->AddCommand(mycommand);
93 virtual ~ModuleCycle()
97 virtual Version GetVersion()
99 return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
104 MODULE_INIT(ModuleCycle)