]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
Was checking 'channel', not 'dest'.
[user/henk/code/inspircd.git] / src / command_parse.cpp
index 11f4b46351bc48dd5c9b910dae1ac293e4fa2868..8722a2145599c9419f0d1ae16b86f0bf9443f218 100644 (file)
@@ -315,17 +315,19 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
 {
        const char *command_p[127];
        int items = 0;
-       std::string para[127];
        irc::tokenstream tokens(cmd);
        std::string command = tokens.GetToken();
 
        while (((para[items] = tokens.GetToken()) != "") && (items < 127))
-               command_p[items] = para[items++].c_str();
+       {
+               command_p[items] = para[items].c_str();
+               items++;
+       }
 
        std::transform(command.begin(), command.end(), command.begin(), ::toupper);
                
        int MOD_RESULT = 0;
-       FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,false));
+       FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,false,cmd));
        if (MOD_RESULT == 1) {
                return;
        }
@@ -372,7 +374,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
                                cm->second->total_bytes += cmd.length();
 
                                int MOD_RESULT = 0;
-                               FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true));
+                               FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true,cmd));
                                if (MOD_RESULT == 1)
                                        return;
 
@@ -383,7 +385,10 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
                                 */
                                CmdResult result = cm->second->Handle(command_p,items,user);
 
-                               FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, items, user, result));
+                               if (result != CMD_USER_DELETED)
+                               {
+                                       FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, items, user, result,cmd));
+                               }
                                return;
                        }
                        else
@@ -471,6 +476,7 @@ bool CommandParser::CreateCommand(command_t *f, void* so_handle)
 
 CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance)
 {
+       para.resize(128);
        this->SetupCommandTable();
 }
 
@@ -512,7 +518,7 @@ bool CommandParser::ReloadCommand(const char* cmd)
                dlclose(command->second);
                RFCCommands.erase(command);
 
-               sprintf(filename, "cmd_%s.so", commandname);
+               snprintf(filename, MAXBUF, "cmd_%s.so", commandname);
                this->LoadCommand(filename);
 
                return true;