2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
5 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
6 * Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
8 * This file is part of InspIRCd. InspIRCd is free software: you can
9 * redistribute it and/or modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation, version 2.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 class CommandClones : public Command
29 CommandClones(Module* Creator) : Command(Creator,"CLONES", 1)
31 flags_needed = 'o'; syntax = "<limit>";
34 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
37 std::string clonesstr = "304 " + user->nick + " :CLONES";
39 unsigned long limit = atoi(parameters[0].c_str());
42 * Syntax of a /clones reply:
43 * :server.name 304 target :CLONES START
44 * :server.name 304 target :CLONES <count> <ip>
45 * :server.name 304 target :CLONES END
48 user->WriteServ(clonesstr + " START");
50 /* hostname or other */
51 // XXX I really don't like marking global_clones public for this. at all. -- w00t
52 for (clonemap::iterator x = ServerInstance->Users->global_clones.begin(); x != ServerInstance->Users->global_clones.end(); x++)
54 if (x->second >= limit)
55 user->WriteServ(clonesstr + " "+ ConvToStr(x->second) + " " + x->first.str());
58 user->WriteServ(clonesstr + " END");
64 class ModuleClones : public Module
68 ModuleClones() : cmd(this)
72 Version GetVersion() CXX11_OVERRIDE
74 return Version("Provides the /CLONES command to retrieve information on clones.", VF_VENDOR);
78 MODULE_INIT(ModuleClones)