From c56bea9d5fcbf239a63992eb9a141b43cb780184 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 9 Sep 2022 02:01:47 +0100 Subject: Make internal penalty be specified in millisecs instead of seconds. This removes the need to multiply it later. --- src/command_parse.cpp | 4 ++-- src/coremods/core_channel/cmd_invite.cpp | 2 +- src/coremods/core_channel/cmd_join.cpp | 2 +- src/coremods/core_channel/cmd_topic.cpp | 2 +- src/coremods/core_info/cmd_admin.cpp | 2 +- src/coremods/core_info/cmd_commands.cpp | 4 ++-- src/coremods/core_info/cmd_info.cpp | 2 +- src/coremods/core_info/cmd_modules.cpp | 2 +- src/coremods/core_list.cpp | 2 +- src/coremods/core_oper/cmd_rehash.cpp | 2 +- src/coremods/core_user/cmd_nick.cpp | 4 ++-- src/coremods/core_user/cmd_part.cpp | 2 +- src/coremods/core_user/cmd_user.cpp | 4 ++-- src/coremods/core_user/core_user.cpp | 6 +++--- src/coremods/core_whois.cpp | 2 +- src/coremods/core_whowas.cpp | 2 +- src/modules/m_cycle.cpp | 2 +- src/modules/m_gateway.cpp | 2 +- src/modules/m_knock.cpp | 2 +- src/modules/m_monitor.cpp | 2 +- src/modules/m_password_hash.cpp | 2 +- src/modules/m_spanningtree/override_map.cpp | 2 +- 22 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 8a04ea72f..7f1ddf177 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -181,10 +181,10 @@ void CommandParser::ProcessCommand(LocalUser* user, std::string& command, Comman if (!user->HasPrivPermission("users/flood/no-throttle")) { // If it *doesn't* exist, give it a slightly heftier penalty than normal to deter flooding us crap - unsigned int penalty = (handler ? handler->Penalty * 1000 : 2000); + unsigned int penalty = handler ? handler->penalty : 2000; user->CommandFloodPenalty += penalty; - // Increase their penalty later if we fail and the command has 0 penalty by default (i.e. in Command::Penalty) to + // Increase their penalty later if we fail and the command has 0 penalty by default (i.e. in Command::penalty) to // throttle sending ERR_* from the command parser. If the command does have a non-zero penalty then this is not // needed because we've increased their penalty above. if (penalty == 0) diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index 350634a45..982688c23 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -49,7 +49,7 @@ CommandInvite::CommandInvite(Module* parent, Invite::APIImpl& invapiimpl) : Command(parent, "INVITE", 0, 0) , invapi(invapiimpl) { - Penalty = 4; + penalty = 4000; syntax = { "[ [