2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
5 * Copyright (C) 2007-2008 Craig Edwards <craigedwards@brainbox.cc>
6 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
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/>.
24 /** Handle /STATS. These command handlers can be reloaded by the core,
25 * and handle basic RFC1459 commands. Commands within modules work
26 * the same way, however, they can be fully unloaded, where these
29 class CommandStats : public Command
32 /** Constructor for stats.
34 CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { syntax = "<stats-symbol> [<servername>]"; }
36 * @param parameters The parameters to the comamnd
37 * @param pcnt The number of parameters passed to teh command
38 * @param user The user issuing the command
39 * @return A value from CmdResult to indicate command success or failure.
41 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
42 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
44 if (parameters.size() > 1)
45 return ROUTE_UNICAST(parameters[1]);
46 return ROUTE_LOCALONLY;
50 CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
52 if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName)
55 char search = parameters[0][0];
56 ServerInstance->DoStats(search, user, values);
57 for (size_t i = 0; i < values.size(); i++)
58 user->SendText(":%s", values[i].c_str());
63 COMMAND_INIT(CommandStats)