1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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(Module* Creator) : Command(Creator,"CLONES", 1)
25 flags_needed = 'o'; syntax = "<limit>";
28 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
31 std::string clonesstr = "304 " + std::string(user->nick) + " :CLONES";
33 unsigned long limit = atoi(parameters[0].c_str());
36 * Syntax of a /clones reply:
37 * :server.name 304 target :CLONES START
38 * :server.name 304 target :CLONES <count> <ip>
39 * :server.name 304 target :CHECK END
42 user->WriteServ(clonesstr + " START");
44 /* hostname or other */
45 // XXX I really don't like marking global_clones public for this. at all. -- w00t
46 for (clonemap::iterator x = ServerInstance->Users->global_clones.begin(); x != ServerInstance->Users->global_clones.end(); x++)
48 if (x->second >= limit)
49 user->WriteServ(clonesstr + " "+ ConvToStr(x->second) + " " + assign(x->first));
52 user->WriteServ(clonesstr + " END");
59 class ModuleClones : public Module
64 ModuleClones() : cmd(this)
66 ServerInstance->AddCommand(&cmd);
69 virtual ~ModuleClones()
73 virtual Version GetVersion()
75 return Version("Provides the /clones command to retrieve information on clones.", VF_VENDOR, API_VERSION);
81 MODULE_INIT(ModuleClones)