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 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style CYCLE command. */
20 class cmd_cycle : public command_t
23 cmd_cycle (InspIRCd* Instance) : command_t(Instance,"CYCLE", 0, 1)
25 this->source = "m_cycle.so";
26 syntax = "<channel> :[reason]";
27 TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
30 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
32 chanrec* channel = ServerInstance->FindChan(parameters[0]);
33 std::string reason = ConvToStr("Cycling");
37 /* reason provided, use it */
38 reason = reason + ": " + parameters[1];
44 * technically, this is only ever sent locally, but pays to be safe ;p
48 if (channel->GetStatus(user) < STATUS_VOICE && channel->IsBanned(user))
50 /* banned, boned. drop the message. */
51 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** You may not cycle, as you are banned on channel " + channel->name);
55 /* XXX in the future, this may move to a static chanrec method (the delete.) -- w00t */
56 if (!channel->PartUser(user, reason.c_str()))
59 chanrec::JoinUser(ServerInstance, user, parameters[0], true, "", ServerInstance->Time(true));
66 user->WriteServ("NOTICE %s :*** You are not on this channel", user->nick);
74 class ModuleCycle : public Module
78 ModuleCycle(InspIRCd* Me)
82 mycommand = new cmd_cycle(ServerInstance);
83 ServerInstance->AddCommand(mycommand);
86 virtual ~ModuleCycle()
90 virtual Version GetVersion()
92 return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
97 MODULE_INIT(ModuleCycle)