summaryrefslogtreecommitdiff
path: root/src/command_parse.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-19 15:21:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-19 15:21:51 +0000
commit1328556e3690aa7a6c6003373221c4cc914c1d4d (patch)
tree9937918b7ff76424726a949d34edbc1ba38f3dc0 /src/command_parse.cpp
parentfe96061b003b7064b3e17c468a8851784890f7b8 (diff)
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
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r--src/command_parse.cpp10
1 files changed, 7 insertions, 3 deletions
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()