]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
Add factories for other types
[user/henk/code/inspircd.git] / src / command_parse.cpp
index 0c3f29a25151572ed715b904c0e2c2c17c0756d9..5492e26b5d54717ca44799b40f4cb2d389ab47cd 100644 (file)
@@ -219,26 +219,29 @@ CmdResult CommandParser::CallHandler(const std::string &commandname,const char**
 void CommandParser::DoLines(User* current, bool one_only)
 {
        // while there are complete lines to process...
-       int floodlines = 0;
+       unsigned int floodlines = 0;
 
        while (current->BufferIsReady())
        {
-               if (ServerInstance->Time() > current->reset_due)
+               if (current->MyClass)
                {
-                       current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold();
-                       current->lines_in = 0;
-               }
+                       if (ServerInstance->Time() > current->reset_due)
+                       {
+                               current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold();
+                               current->lines_in = 0;
+                       }
 
-               if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood())
-               {
-                       ServerInstance->FloodQuitUser(current);
-                       return;
-               }
+                       if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood())
+                       {
+                               ServerInstance->FloodQuitUser(current);
+                               return;
+                       }
 
-               if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0))
-               {
-                       ServerInstance->FloodQuitUser(current);
-                       return;
+                       if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0))
+                       {
+                               ServerInstance->FloodQuitUser(current);
+                               return;
+                       }
                }
 
                // use GetBuffer to copy single lines into the sanitized string
@@ -284,16 +287,6 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
                return true;
        }
 
-       if (!user)
-       {
-               /*
-                * before, we went and found the command even with no user.. seems nonsensical.
-                * I'm not entirely sure when we would be passed NULL, but let's handle it
-                * anyway, by dropping it like a hot potato. -- w00t
-                */
-               return true;
-       }
-
        /* find the command, check it exists */
        Commandable::iterator cm = cmdlist.find(command);
        
@@ -309,17 +302,15 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
        if (!user->ExemptFromPenalty)
        {
                user->IncreasePenalty(cm->second->Penalty);
-               ServerInstance->Log(DEBUG,"Penalty for %s is now incremented to %d (%d added on)", user->nick, user->Penalty, cm->second->Penalty);
                do_more = (user->Penalty < 10);
                if (!do_more)
-               {
                        user->OverPenalty = true;
-                       ServerInstance->Log(DEBUG,"User %s now OVER penalty of 10", user->nick);
-               }
        }
 
        /* activity resets the ping pending timer */
-       user->nping = ServerInstance->Time() + user->MyClass->GetPingTime();
+       if (user->MyClass)
+               user->nping = ServerInstance->Time() + user->MyClass->GetPingTime();
+
        if (cm->second->flags_needed)
        {
                if (!user->IsModeSet(cm->second->flags_needed))