]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_stats.cpp
m_callerid Use std::find() where possible
[user/henk/code/inspircd.git] / src / commands / cmd_stats.cpp
index 6180709a74ff372a7022159cb41ff662f479fe52..2ed5eedcdfe5e3eacdfc2ae779815e8538c8717f 100644 (file)
@@ -1,16 +1,24 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007-2008 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
  *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include "inspircd.h"
 #ifndef WIN32
        #include <sys/resource.h>
@@ -44,23 +52,23 @@ class CommandStats : public 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;
 }