]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_user/core_user.cpp
Convert WriteNumeric() calls to pass the parameters of the numeric as method parameters
[user/henk/code/inspircd.git] / src / coremods / core_user / core_user.cpp
index ffa6aa2ff3de81c2ef37a3c6b976a3a8761b50c7..a2ffc009ebd9283b670a706329242800d53c7be3 100644 (file)
@@ -45,7 +45,8 @@ class CommandPass : public SplitCommand
                // Check to make sure they haven't registered -- Fix by FCS
                if (user->registered == REG_ALL)
                {
-                       user->WriteNumeric(ERR_ALREADYREGISTERED, ":You may not reregister");
+                       user->CommandFloodPenalty += 1000;
+                       user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not reregister");
                        return CMD_FAILURE;
                }
                user->password = parameters[0];
@@ -64,7 +65,6 @@ class CommandPing : public Command
        CommandPing(Module* parent)
                : Command(parent, "PING", 1, 2)
        {
-               Penalty = 0;
                syntax = "<servername> [:<servername>]";
        }
 
@@ -102,8 +102,15 @@ class CommandPong : public Command
        CmdResult Handle(const std::vector<std::string>& parameters, User* user)
        {
                // set the user as alive so they survive to next ping
-               if (IS_LOCAL(user))
-                       IS_LOCAL(user)->lastping = 1;
+               LocalUser* localuser = IS_LOCAL(user);
+               if (localuser)
+               {
+                       // Increase penalty unless we've sent a PING and this is the reply
+                       if (localuser->lastping)
+                               localuser->CommandFloodPenalty += 1000;
+                       else
+                               localuser->lastping = 1;
+               }
                return CMD_SUCCESS;
        }
 };