1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 * ---------------------------------------------------
19 /* $ModDesc: Provides support for unreal-style CYCLE command. */
23 class cmd_cycle : public command_t
26 cmd_cycle (InspIRCd* Instance) : command_t(Instance,"CYCLE", 0, 1)
28 this->source = "m_cycle.so";
29 syntax = "<channel> :[reason]";
32 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
34 chanrec* channel = ServerInstance->FindChan(parameters[0]);
35 std::string reason = ConvToStr("Cycling");
39 /* reason provided, use it */
40 reason = reason + ": " + parameters[1];
46 * technically, this is only ever sent locally, but pays to be safe ;p
50 if (channel->GetStatus(user) < STATUS_VOICE && channel->IsBanned(user))
52 /* banned, boned. drop the message. */
53 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** You may not cycle, as you are banned on channel " + channel->name);
57 /* XXX in the future, this may move to a static chanrec method (the delete.) -- w00t */
58 if (!channel->PartUser(user, reason.c_str()))
61 chanrec::JoinUser(ServerInstance, user, parameters[0], true, "", ServerInstance->Time(true));
68 user->WriteServ("NOTICE %s :*** You are not on this channel", user->nick);
76 class ModuleCycle : public Module
80 ModuleCycle(InspIRCd* Me)
84 mycommand = new cmd_cycle(ServerInstance);
85 ServerInstance->AddCommand(mycommand);
88 virtual ~ModuleCycle()
92 virtual Version GetVersion()
94 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
99 MODULE_INIT(ModuleCycle)