]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/userprocess.cpp
Move some stuff around so the last penalty line doesnt get held erroneously until...
[user/henk/code/inspircd.git] / src / userprocess.cpp
index 9009cf061bb801465c1c88a96604bedcc7c3c3cb..68c469aacd7a344c1f1d6810caac285ac0fa71e9 100644 (file)
@@ -72,7 +72,6 @@ void ProcessUserHandler::Call(User* cu)
        {
                User *current;
                int currfd;
-               int floodlines = 0;
 
                Server->stats->statsRecv += result;
                /*
@@ -123,36 +122,9 @@ void ProcessUserHandler::Call(User* cu)
                                return;
                        }
 
-                       // while there are complete lines to process...
-                       while (current->BufferIsReady())
-                       {
-                               if (Server->Time() > current->reset_due)
-                               {
-                                       current->reset_due = Server->Time() + current->threshold;
-                                       current->lines_in = 0;
-                               }
-
-                               if (++current->lines_in > current->flood && current->flood)
-                               {
-                                       Server->FloodQuitUser(current);
-                                       return;
-                               }
-
-                               if ((++floodlines > current->flood) && (current->flood != 0))
-                               {
-                                       Server->FloodQuitUser(current);
-                                       return;
-                               }
-
-                               // use GetBuffer to copy single lines into the sanitized string
-                               std::string single_line = current->GetBuffer();
-                               current->bytes_in += single_line.length();
-                               current->cmds_in++;
-                               if (single_line.length() > MAXBUF - 2)  /* MAXBUF is 514 to allow for neccessary line terminators */
-                                       single_line.resize(MAXBUF - 2); /* So to trim to 512 here, we use MAXBUF - 2 */
-
-                               Server->Parser->ProcessBuffer(single_line, current);
-                       }
+                       /* If user is over penalty, dont process here, just build up */
+                       if (!current->OverPenalty)
+                               Server->Parser->DoLines(current);
 
                        return;
                }
@@ -190,6 +162,19 @@ void InspIRCd::DoBackgroundUserStuff()
        {
                User *curr = *count2;
 
+               if (curr->Penalty)
+               {
+                       curr->Penalty--;
+                       if (curr->Penalty < 10)
+                               Parser->DoLines(curr, true);
+               }
+
+               if (curr->OverPenalty)
+               {
+                       if (curr->sendq.empty())
+                               curr->OverPenalty = false;
+               }
+
                if ((curr->registered != REG_ALL) && (TIME > curr->timeout))
                {
                        /*