diff options
author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-04-02 22:59:27 +0000 |
---|---|---|
committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-04-02 22:59:27 +0000 |
commit | 48ef6617acff38cdce32233d447c4317b61ab048 (patch) | |
tree | c13b67f905da74fe8c4f446ef6cc43aa2039fb60 /src/commands.c | |
parent | ef400fa6dc98f8be74a37725beb3ef67405d458c (diff) |
Remove capability for commands to hook existing commands, add an OnPreCommand event instead. Tidies up a lot of stuff. Also remove a bunch of dead code.
NOTE: This will break some stuff.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2241 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/commands.c b/src/commands.c index 4add1c552..e7f5522ed 100644 --- a/src/commands.c +++ b/src/commands.c @@ -53,7 +53,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * { Command *c = findCommand(cmdTable, cmd); int retVal = 0; - Command *current; + if (!c) { @@ -120,16 +120,12 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * return; } + EventReturn MOD_RESULT = EVENT_CONTINUE; + FOREACH_RESULT(I_OnPreCommand, OnPreCommand(u, c->name, params)); + if (MOD_RESULT == EVENT_STOP) + return; + retVal = c->Execute(u, params); - if (retVal == MOD_CONT) - { - current = c->next; - while (current && retVal == MOD_CONT) - { - retVal = current->Execute(u, params); - current = current->next; - } - } } /*************************************************************************/ @@ -145,9 +141,6 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[], const char *cmd) { - bool has_had_help = false; - int cont = MOD_CONT; - spacesepstream tokens(cmd); std::string token; tokens.GetToken(token); @@ -156,9 +149,7 @@ void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[], std::string subcommand = tokens.StreamEnd() ? "" : tokens.GetRemaining(); - for (Command *current = c; current && cont == MOD_CONT; current = current->next) - has_had_help = current->OnHelp(u, subcommand); - if (!has_had_help) + if (!c->OnHelp(u, subcommand)) notice_lang(service, u, NO_HELP_AVAILABLE, cmd); } |