From 5d18f26b6bfb7a575b50dc2e3ad909131b9f75da Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 16 Jul 2006 13:02:38 +0000 Subject: Fix case sensitive commands issue due to new std::string based parser, improve the craq disabled commands check that was potentially O(n) where n is the number of disabled commands (erk) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4404 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configreader.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index 04918e7cf..b5ea8a815 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -200,6 +200,28 @@ bool ValidateDnsTimeout(const char* tag, const char* value, void* data) return true; } +bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance) +{ + std::stringstream dcmds(data); + std::string thiscmd; + + /* Enable everything first */ + for (nspace::hash_map::iterator x = ServerInstance->Parser->cmdlist.begin(); x != ServerInstance->Parser->cmdlist.end(); x++) + x->second->Disable(false); + + /* Now disable all the ones which the user wants disabled */ + while (dcmds >> thiscmd) + { + nspace::hash_map::iterator cm = ServerInstance->Parser->cmdlist.find(thiscmd); + if (cm != ServerInstance->Parser->cmdlist.end()) + { + log(DEBUG,"Disabling command '%s'",cm->second->command.c_str()); + cm->second->Disable(true); + } + } + return true; +} + bool ValidateDnsServer(const char* tag, const char* value, void* data) { char* x = (char*)data; -- cgit v1.3.1-10-gc9f91