diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-10-29 16:06:23 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-10-29 16:06:23 +0000 |
commit | f103942e505e416dd541429bfd4f50cc3dd696f4 (patch) | |
tree | 6ee36f7c6ded57ba9c75dc3eddb46bd54f2d0fe5 | |
parent | b81e496c6dad5a48e4158870149b6c3f4d04b9df (diff) |
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
-rw-r--r-- | src/command_parse.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
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) |