From 1328556e3690aa7a6c6003373221c4cc914c1d4d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 19 Feb 2006 15:21:51 +0000 Subject: Server::AddExtendedMode and Server::AddCommand will now throw exceptions when adding a bad mode or already existing command. If the module constructor does not handle this exception, this will abort the module's constructor, forbidding loading of modules which are unable to function (smart eh) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3246 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/command_parse.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/command_parse.cpp') diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 7c9e5aa5c..e735ad828 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -742,9 +742,13 @@ void CommandParser::ProcessBuffer(const char* cmdbuf,userrec *user) bool CommandParser::CreateCommand(command_t *f) { /* create the command and push it onto the table */ - cmdlist[f->command] = f; - log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params); - return true; + if (cmdlist.find(f->command) != cmdlist.end()) + { + cmdlist[f->command] = f; + log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params); + return true; + } + else return false } CommandParser::CommandParser() -- cgit v1.3.1-10-gc9f91