]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
Update documentation and remove unused classes/functions
[user/henk/code/inspircd.git] / src / command_parse.cpp
index c8ca7d59e404ab8a504b8fd396f23273b796f13d..6dd4e663e04726411b63c904d201faab6d5b785f 100644 (file)
@@ -11,8 +11,6 @@
  * ---------------------------------------------------
  */
 
-/* $Core */
-
 #include "inspircd.h"
 #include "xline.h"
 #include "socketengine.h"
@@ -255,7 +253,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
        {
                // If it *doesn't* exist, give it a slightly heftier penalty than normal to deter flooding us crap
                user->IncreasePenalty(cm != cmdlist.end() ? cm->second->Penalty : 2);
-               do_more = (user->Penalty < 10);
+               do_more = (user->GetClass()->GetPenaltyThreshold() && ((unsigned long)user->Penalty < user->GetClass()->GetPenaltyThreshold()));
        }
 
 
@@ -396,24 +394,16 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
        }
 }
 
-void CommandParser::RemoveCommands(Module* source)
+void CommandParser::RemoveCommand(Command* x)
 {
-       Commandtable::iterator i,safei;
-       for (i = cmdlist.begin(); i != cmdlist.end();)
-       {
-               safei = i;
-               i++;
-               RemoveCommand(safei, source);
-       }
+       Commandtable::iterator n = cmdlist.find(x->command);
+       if (n != cmdlist.end() && n->second == x)
+               cmdlist.erase(n);
 }
 
-void CommandParser::RemoveCommand(Commandtable::iterator safei, Module* source)
+Command::~Command()
 {
-       Command* x = safei->second;
-       if (x->creator == source)
-       {
-               cmdlist.erase(safei);
-       }
+       ServerInstance->Parser->RemoveCommand(this);
 }
 
 bool CommandParser::ProcessBuffer(std::string &buffer,User *user)
@@ -426,7 +416,7 @@ bool CommandParser::ProcessBuffer(std::string &buffer,User *user)
        return ProcessCommand(user,buffer);
 }
 
-bool CommandParser::CreateCommand(Command *f)
+bool CommandParser::AddCommand(Command *f)
 {
        /* create the command and push it onto the table */
        if (cmdlist.find(f->command) == cmdlist.end())