1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 05:13:13 +02:00

Move more stuff to a module class.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1593 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Robin Burchell w00t@inspircd.org
2008-11-08 16:23:26 +00:00
parent 876a2519d5
commit e701a1e2ad
2 changed files with 18 additions and 25 deletions
+14 -5
View File
@@ -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);
+4 -20
View File
@@ -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);
}