diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-06 16:12:38 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-06 16:12:38 +0000 |
commit | 73324216571a2d62ae3210fa99ac5d15271d83ea (patch) | |
tree | 950fe21f2da5679d0f4b9b2716dfd26951950601 /src/modules/m_abbreviation.cpp | |
parent | 715eba3932edef74b3983792be524192bb0fa102 (diff) |
If we have > 10 matches to a command, abort and dont try and show the list. This stops "/." listing a massive amount of commands too long to show, and keeps things within common sense. :P
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9848 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_abbreviation.cpp')
-rw-r--r-- | src/modules/m_abbreviation.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index dbda047b5..c80df1858 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -45,6 +45,7 @@ class ModuleAbbreviation : public Module /* Look for any command that starts with the same characters, if it does, replace the command string with it */ size_t clen = command.length(); std::string foundcommand, matchlist; + size_t matches = 0; bool foundmatch = false; for (Commandtable::iterator n = ServerInstance->Parser->cmdlist.begin(); n != ServerInstance->Parser->cmdlist.end(); ++n) { @@ -53,6 +54,12 @@ class ModuleAbbreviation : public Module if (command == n->first.substr(0, clen)) { + if (++matches > 10) + { + user->WriteNumeric(420, "%s :Ambiguous abbreviation and too many possible matches.", user->nick.c_str()); + return false; + } + if (!foundmatch) { /* Found the command */ |