From 48ef6617acff38cdce32233d447c4317b61ab048 Mon Sep 17 00:00:00 2001 From: rburchell Date: Thu, 2 Apr 2009 22:59:27 +0000 Subject: 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 --- include/modules.h | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/modules.h b/include/modules.h index 8b0144d85..ca37fe4c9 100644 --- a/include/modules.h +++ b/include/modules.h @@ -281,13 +281,7 @@ class CoreExport Command int core; /* Can this command be deleted? */ char *mod_name; /* Name of the module who owns us, NULL for core's */ char *service; /* Service we provide this command for */ - int (*all_help)(User *u); - int (*regular_help)(User *u); - int (*oper_help)(User *u); - int (*admin_help)(User *u); - int (*root_help)(User *u); - - Command *next; /* Next command responsible for the same command */ + Command *next; }; /** Every module in Anope is actually a class. */ @@ -510,6 +504,14 @@ class CoreExport Module */ virtual void OnServerConnect(Server *s) { } + /** Called before a command is due to be executed. + * @param u The user executing the command + * @param command The command the user is executing + * @param params The parameters the user is sending + * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it + */ + virtual EventReturn OnPreCommand(User *u, const std::string &command, const std::vector ¶ms) { return EVENT_CONTINUE; } + /** Called when anope saves databases. * NOTE: This event is deprecated pending new database handling. * XXX. @@ -529,6 +531,7 @@ enum Implementation { I_BEGIN, I_OnUserKicked, I_OnReload, I_OnBotAssign, I_OnBotUnAssign, I_OnUserConnect, I_OnServerConnect, + I_OnPreCommand, I_OnSaveDatabase, I_OnBackupDatabase, I_END }; @@ -678,14 +681,7 @@ int encryption_module_init(); /* Load the encryption module */ int protocol_module_init(); /* Load the IRCD Protocol Module up*/ void moduleCallBackPrepForUnload(const char *mod_name); MDE void moduleCallBackDeleteEntry(ModuleCallBack * prev); -MDE char *moduleGetLastBuffer(); MDE void moduleDisplayHelp(int service, User *u); -MDE int moduleAddHelp(Command * c, int (*func) (User * u)); -MDE int moduleAddRegHelp(Command * c, int (*func) (User * u)); -MDE int moduleAddOperHelp(Command * c, int (*func) (User * u)); -MDE int moduleAddAdminHelp(Command * c, int (*func) (User * u)); -MDE int moduleAddRootHelp(Command * c, int (*func) (User * u)); -extern MDE char *mod_current_buffer; /*************************************************************************/ /*************************************************************************/ -- cgit