diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-08 16:23:26 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-08 16:23:26 +0000 |
commit | e701a1e2adf0453e1a32bce38b1a70a05cd8f06b (patch) | |
tree | eef485c0f76b40dabd8500e09543c2739117883b | |
parent | 876a2519d5a952607eb2c998361a10a07577be30 (diff) |
Move more stuff to a module class.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1593 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/modules.h | 19 | ||||
-rw-r--r-- | src/events.c | 24 |
2 files changed, 18 insertions, 25 deletions
diff --git a/include/modules.h b/include/modules.h index 7b179b20b..8ab8977f0 100644 --- a/include/modules.h +++ b/include/modules.h @@ -192,17 +192,28 @@ CoreExport class Module * @param m the Message to add * @param pos the Position to add the message to, e.g. MOD_HEAD, MOD_TAIL, MOD_UNIQUE * @return MOD_ERR_OK on success, althing else on fail. - * **/ int AddEventHook(EvtHook *evh); - /** - * Add a module message to the IRCD message hash + /** Add a module message to the IRCD message hash * @param m the Message to add * @param pos the Position to add the message to, e.g. MOD_HEAD, MOD_TAIL, MOD_UNIQUE * @return MOD_ERR_OK on success, althing else on fail. **/ int AddEventHandler(EvtMessage *evm); + + /** Remove the given message from the IRCD message hash + * @param name the name of the message to remove + * @return MOD_ERR_OK on success, althing else on fail. + **/ + int DelEventHandler(const char *name); + + /** + * remove the given message from the IRCD message hash + * @param name the name of the message to remove + * @return MOD_ERR_OK on success, althing else on fail. + **/ + int DelEventHook(const char *name); }; struct ModuleHash_ { @@ -372,7 +383,6 @@ int destroyMessage(Message *m); /* destroy a Message*/ MDE EvtMessage *createEventHandler(char *name, int (*func) (const char *source, int ac, const char **av)); EvtMessage *findEventHandler(EvtMessageHash * msgEvtTable[], const char *name); int addCoreEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm); -MDE int moduleEventDelHandler(char *name); int delEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm, const char *mod_name); int destroyEventHandler(EvtMessage * evm); int addEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm); @@ -380,7 +390,6 @@ int addEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm); MDE EvtHook *createEventHook(const char *name, int (*func) (int argc, char **argv)); EvtHook *findEventHook(EvtHookHash * HookEvtTable[], const char *name); int addCoreEventHook(EvtHookHash * HookEvtTable[], EvtHook * evh); -MDE int moduleEventDelHook(const char *name); int delEventHook(EvtHookHash * HookEvtTable[], EvtHook * evh, const char *mod_name); int destroyEventHook(EvtHook * evh); diff --git a/src/events.c b/src/events.c index 006c3273e..17c9903cc 100644 --- a/src/events.c +++ b/src/events.c @@ -512,50 +512,34 @@ int Module::AddEventHook(EvtHook *evh) return status; } -/** - * remove the given message from the IRCD message hash - * @param name the name of the message to remove - * @return MOD_ERR_OK on success, althing else on fail. - **/ -int moduleEventDelHandler(char *name) +int Module::DelEventHandler(const char *name) { EvtMessage *evm; int status; - if (!mod_current_module) { - return MOD_ERR_UNKNOWN; - } evm = findEventHandler(EVENT, name); if (!evm) { return MOD_ERR_NOEXIST; } - status = delEventHandler(EVENT, evm, mod_current_module->name.c_str()); + status = delEventHandler(EVENT, evm, this->name.c_str()); if (debug) { displayEvtMessageFromHash(evm->name); } return status; } -/** - * remove the given message from the IRCD message hash - * @param name the name of the message to remove - * @return MOD_ERR_OK on success, althing else on fail. - **/ -int moduleEventDelHook(const char *name) +int Module::DelEventHook(const char *name) { EvtHook *evh; int status; - if (!mod_current_module) { - return MOD_ERR_UNKNOWN; - } evh = findEventHook(EVENTHOOKS, name); if (!evh) { return MOD_ERR_NOEXIST; } - status = delEventHook(EVENTHOOKS, evh, mod_current_module->name.c_str()); + status = delEventHook(EVENTHOOKS, evh, this->name.c_str()); if (debug) { displayHookFromHash(evh->name); } |