]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_stats.cpp
Fix more incorrect std::string::operator[] usage
[user/henk/code/inspircd.git] / src / commands / cmd_stats.cpp
index 60bb5b30ee7ae3a586276fd0834178bbdbf546b5..aa5bf44cd50dd1cb1492c00858799a540adf759b 100644 (file)
@@ -39,7 +39,7 @@ class CommandStats : public Command
  public:
        /** Constructor for stats.
         */
-       CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { syntax = "<stats-symbol> [<servername>]"; }
+       CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { allow_empty_last_param = false; syntax = "<stats-symbol> [<servername>]"; }
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
@@ -420,7 +420,13 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
 CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
 {
        if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName)
+       {
+               // Give extra penalty if a non-oper does /STATS <remoteserver>
+               LocalUser* localuser = IS_LOCAL(user);
+               if ((localuser) && (!IS_OPER(user)))
+                       localuser->CommandFloodPenalty += 2000;
                return CMD_SUCCESS;
+       }
        string_list values;
        char search = parameters[0][0];
        DoStats(search, user, values);