From 61185fc62b7d3d05e33a116fca26aa9dc72ab691 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 6 Jun 2008 15:47:39 +0000 Subject: m_abbreviation completed. :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9845 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_abbreviation.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/modules/m_abbreviation.cpp') diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index bc04cc307..35a6082d9 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -45,6 +45,22 @@ class ModuleAbbreviation : public Module ServerInstance->Logs->Log("m_abbreviation", DEBUG, "Abbreviated command: %s", command.c_str()); + size_t clen = command.length(); + for (Commandtable::iterator n = ServerInstance->Parser->cmdlist.begin(); n != ServerInstance->Parser->cmdlist.end(); ++n) + { + if (n->first.length() < clen) + continue; + + ServerInstance->Logs->Log("m_abbreviation", DEBUG, "command=%s abbr=%s", command.c_str(), n->first.substr(0, clen).c_str()); + if (command == n->first.substr(0, clen)) + { + /* Found the command */ + command = n->first; + return false; + } + } + + command += '.'; return false; } }; -- cgit v1.2.3