diff options
-rw-r--r-- | include/command_parse.h | 4 | ||||
-rw-r--r-- | src/command_parse.cpp | 13 | ||||
-rw-r--r-- | src/inspircd.cpp | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/include/command_parse.h b/include/command_parse.h index 3177dc95b..2cf403de1 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -182,6 +182,10 @@ class CoreExport CommandParser : public classbase */ void RemoveCommands(const char* source); + /** Remove all core commands and unload their shared objects + */ + void RemoveRFCCommands(); + /** Add a new command to the commands hash * @param f The new Command to add to the list * @param so_handle The handle to the shared object where the command can be found. diff --git a/src/command_parse.cpp b/src/command_parse.cpp index b063e392c..3f8f63c48 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -425,6 +425,19 @@ void CommandParser::RemoveCommands(const char* source) } } +void CommandParser::RemoveRFCCommands() +{ + for(SharedObjectList::iterator c = RFCCommands.begin(); c != RFCCommands.end(); c++) + { + std::string cmd = c->first; + Command* cmdptr = cmdlist.find(cmd)->second; + cmdlist.erase(cmdlist.find(cmd)); + delete cmdptr; + dlclose(c->second); + } + RFCCommands.clear(); +} + void CommandParser::RemoveCommand(Commandtable::iterator safei, const char* source) { Command* x = safei->second; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index d7239e0b4..28aa0e1b9 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -127,7 +127,7 @@ void InspIRCd::Cleanup() } } /* Remove core commands */ - Parser->RemoveCommands("<core>"); + Parser->RemoveRFCCommands(); /* Cleanup Server Names */ for(servernamelist::iterator itr = servernames.begin(); itr != servernames.end(); ++itr) |