1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 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 the /clones command to retrieve information on clones. */
20 class CommandClones : public Command
23 CommandClones (InspIRCd* Instance) : Command(Instance,"CLONES", "o", 1)
25 this->source = "m_clones.so";
29 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
32 std::string clonesstr = "304 " + std::string(user->nick) + " :CLONES";
34 unsigned long limit = atoi(parameters[0].c_str());
37 * Syntax of a /clones reply:
38 * :server.name 304 target :CLONES START
39 * :server.name 304 target :CLONES <count> <ip>
40 * :server.name 304 target :CHECK END
43 user->WriteServ(clonesstr + " START");
45 /* hostname or other */
46 // XXX I really don't like marking global_clones public for this. at all. -- w00t
47 for (clonemap::iterator x = ServerInstance->Users->global_clones.begin(); x != ServerInstance->Users->global_clones.end(); x++)
49 if (x->second >= limit)
50 user->WriteServ(clonesstr + " "+ ConvToStr(x->second) + " " + assign(x->first));
53 user->WriteServ(clonesstr + " END");
60 class ModuleClones : public Module
63 CommandClones *mycommand;
65 ModuleClones(InspIRCd* Me) : Module(Me)
68 mycommand = new CommandClones(ServerInstance);
69 ServerInstance->AddCommand(mycommand);
73 virtual ~ModuleClones()
77 virtual Version GetVersion()
79 return Version("$Id$", VF_VENDOR, API_VERSION);
85 MODULE_INIT(ModuleClones)