From 0f87ad0d4b97874823c94a5168a06dcd444ad559 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 11 Nov 2009 19:52:03 +0000 Subject: Add fine-grained command flood controls This reintrouces "Excess Flood" quits for those that prefer it to fakelag, and allows the maximum command rate to be set in the connect block. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12093 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/userprocess.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/userprocess.cpp') diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 8aa76a1fd..781f8ae52 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -55,9 +55,13 @@ void InspIRCd::DoBackgroundUserStuff() if (curr->quitting) continue; - if (curr->Penalty) + if (curr->CommandFloodPenalty) { - curr->Penalty--; + unsigned int rate = curr->MyClass->GetCommandRate(); + if (curr->CommandFloodPenalty > rate) + curr->CommandFloodPenalty -= rate; + else + curr->CommandFloodPenalty = 0; curr->eh.OnDataReady(); } -- cgit v1.2.3