]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
Refactor port binding, warning not yet tested fully
[user/henk/code/inspircd.git] / src / command_parse.cpp
index f013e0cd5a052f35d9c12be6b0384416fcccdf45..6fdf1800c7d34f04d5b3f59a53f38c7b4d12dc96 100644 (file)
@@ -224,7 +224,7 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
 
 bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, userrec * user)
 {
-       nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
+       command_table::iterator n = cmdlist.find(commandname);
 
        if (n != cmdlist.end())
        {
@@ -245,7 +245,7 @@ bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, use
 
 command_t* CommandParser::GetHandler(const std::string &commandname)
 {
-       nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
+       command_table::iterator n = cmdlist.find(commandname);
        if (n != cmdlist.end())
                return n->second;
 
@@ -256,7 +256,7 @@ command_t* CommandParser::GetHandler(const std::string &commandname)
 
 CmdResult CommandParser::CallHandler(const std::string &commandname,const char** parameters, int pcnt, userrec *user)
 {
-       nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
+       command_table::iterator n = cmdlist.find(commandname);
 
        if (n != cmdlist.end())
        {
@@ -289,6 +289,14 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
        std::string command;
        tokens.GetToken(command);
 
+       /* A client sent a nick prefix on their command (ick)
+        * rhapsody and some braindead bouncers do this --
+        * the rfc says they shouldnt but also says the ircd should
+        * discard it if they do.
+        */
+       if (*command.c_str() == ':')
+               tokens.GetToken(command);
+
        while (tokens.GetToken(para[items]) && (items < 127))
        {
                command_p[items] = para[items].c_str();
@@ -303,7 +311,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
                return;
        }
 
-       nspace::hash_map<std::string,command_t*>::iterator cm = cmdlist.find(command);
+       command_table::iterator cm = cmdlist.find(command);
        
        if (cm != cmdlist.end())
        {
@@ -375,7 +383,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
 
 bool CommandParser::RemoveCommands(const char* source)
 {
-       nspace::hash_map<std::string,command_t*>::iterator i,safei;
+       command_table::iterator i,safei;
        for (i = cmdlist.begin(); i != cmdlist.end(); i++)
        {
                safei = i;
@@ -393,7 +401,7 @@ bool CommandParser::RemoveCommands(const char* source)
        return true;
 }
 
-void CommandParser::RemoveCommand(nspace::hash_map<std::string,command_t*>::iterator safei, const char* source)
+void CommandParser::RemoveCommand(command_table::iterator safei, const char* source)
 {
        command_t* x = safei->second;
        if (x->source == std::string(source))