From 813c8981600b440a7cf762607fa6518b9e9b3d56 Mon Sep 17 00:00:00 2001 From: w00t Date: Sat, 25 Oct 2008 16:41:11 +0000 Subject: By moving OnPreCommand call in two places, modules (even with unverified commands) can still recieve the command with max_params at most if it exists. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10716 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/command_parse.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 984ce2314..fd1039088 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -277,21 +277,18 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) std::transform(command.begin(), command.end(), command.begin(), ::toupper); - int MOD_RESULT = 0; - FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, false, cmd)); - if (MOD_RESULT == 1) { - return true; - } - /* find the command, check it exists */ Commandtable::iterator cm = cmdlist.find(command); if (cm == cmdlist.end()) { + int MOD_RESULT = 0; + FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, false, cmd)); + if (MOD_RESULT == 1) + return true; + if (user->registered == REG_ALL) - { user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :Unknown command",user->nick.c_str(),command.c_str()); - } ServerInstance->stats->statsUnknown++; return true; } @@ -333,6 +330,11 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) command_p.push_back(lparam); } + int MOD_RESULT = 0; + FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, false, cmd)); + if (MOD_RESULT == 1) + return true; + /* Modify the user's penalty */ bool do_more = true; if (!user->ExemptFromPenalty) -- cgit v1.2.3