diff options
-rw-r--r-- | include/modules.h | 8 | ||||
-rw-r--r-- | src/events.c | 37 |
2 files changed, 19 insertions, 26 deletions
diff --git a/include/modules.h b/include/modules.h index d20cd7dc5..9ffbd8ea3 100644 --- a/include/modules.h +++ b/include/modules.h @@ -177,6 +177,14 @@ CoreExport class Module * @param av The language sring list. **/ void InsertLanguage(int langNumber, int ac, const char **av); + + /** 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 AddEventHook(EvtHook *evh); }; struct ModuleHash_ { diff --git a/src/events.c b/src/events.c index 65338b166..f8a6f1601 100644 --- a/src/events.c +++ b/src/events.c @@ -511,37 +511,22 @@ int moduleAddEventHandler(EvtMessage * evm) return status; } -/** - * 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 moduleAddEventHook(EvtHook * evh) +int Module::AddEventHook(EvtHook *evh) { - int status; + int status; - if (!evh) { - return MOD_ERR_PARAMS; - } + if (!evh) + return MOD_ERR_PARAMS; - if ((mod_current_module_name) && (!mod_current_module)) { - mod_current_module = findModule(mod_current_module_name); - } + evh->core = 0; + if (!evh->mod_name) + evh->mod_name = sstrdup(this->name.c_str()); - if (!mod_current_module) { - return MOD_ERR_UNKNOWN; - } /* shouldnt happen */ - evh->core = 0; - if (!evh->mod_name) { - evh->mod_name = sstrdup(mod_current_module->name.c_str()); - } + status = addEventHook(EVENTHOOKS, evh); + if (debug) + displayHookFromHash(evh->name); - status = addEventHook(EVENTHOOKS, evh); - if (debug) { - displayHookFromHash(evh->name); - } - return status; + return status; } /** |