From f103942e505e416dd541429bfd4f50cc3dd696f4 Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 29 Oct 2008 16:06:23 +0000 Subject: Fix for "unknown commands" w/ m_abbreviation, thanks dz for making me understand this. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10749 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/command_parse.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/command_parse.cpp') diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 7204461c2..67fc05231 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -287,10 +287,21 @@ bool CommandParser::ProcessCommand(User *user, std::string &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; + /* + * This double lookup is in case a module (abbreviation) wishes to change a command. + * Sure, the double lookup is a bit painful, but bear in mind this only happens for unknowns anyway. + * + * Thanks dz for making me actually understand why this is necessary! + * -- w00t + */ + Commandtable::iterator cm = cmdlist.find(command); + if (cm == cmdlist.end()) + { + 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; + } } if (cm->second->max_params && command_p.size() > cm->second->max_params) -- cgit v1.2.3