* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
public:
/** Constructor for stats.
*/
- CommandStats ( Module* parent) : Command(parent,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; }
+ CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { syntax = "<stats-symbol> [<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
* @return A value from CmdResult to indicate command success or failure.
*/
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+ RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+ {
+ if (parameters.size() > 1)
+ return ROUTE_UNICAST(parameters[1]);
+ return ROUTE_LOCALONLY;
+ }
};
CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (IS_LOCAL(user))
- {
- string_list values;
- if (parameters[0].empty())
- {
- user->WriteNumeric(ERR_NEEDMOREPARAMS, "%s STATS :Not enough parameters.", user->nick.c_str());
- return CMD_FAILURE;
- }
- char search = parameters[0][0];
- ServerInstance->DoStats(search, user, values);
- for (size_t i = 0; i < values.size(); i++)
- user->Write(":%s", values[i].c_str());
- }
+ if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName)
+ return CMD_SUCCESS;
+ string_list values;
+ char search = parameters[0][0];
+ ServerInstance->DoStats(search, user, values);
+ for (size_t i = 0; i < values.size(); i++)
+ user->SendText(":%s", values[i].c_str());
return CMD_SUCCESS;
}