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 * ---------------------------------------------------
17 /* $ModDesc: Provides the /clones command to retrieve information on clones. */
21 class CommandClones : public Command
24 CommandClones (InspIRCd* Instance) : Command(Instance,"CLONES", "o", 1)
26 this->source = "m_clones.so";
30 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
33 std::string clonesstr = "304 " + std::string(user->nick) + " :CLONES";
35 unsigned long limit = atoi(parameters[0].c_str());
38 * Syntax of a /clones reply:
39 * :server.name 304 target :CLONES START
40 * :server.name 304 target :CLONES <count> <ip>
41 * :server.name 304 target :CHECK END
44 user->WriteServ(clonesstr + " START");
46 /* hostname or other */
47 // XXX I really don't like marking global_clones public for this. at all. -- w00t
48 for (clonemap::iterator x = ServerInstance->Users->global_clones.begin(); x != ServerInstance->Users->global_clones.end(); x++)
50 if (x->second >= limit)
51 user->WriteServ(clonesstr + " "+ ConvToStr(x->second) + " " + assign(x->first));
54 user->WriteServ(clonesstr + " END");
61 class ModuleClones : public Module
64 CommandClones *mycommand;
66 ModuleClones(InspIRCd* Me) : Module(Me)
69 mycommand = new CommandClones(ServerInstance);
70 ServerInstance->AddCommand(mycommand);
74 virtual ~ModuleClones()
78 virtual Version GetVersion()
80 return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
86 MODULE_INIT(ModuleClones)