1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-10 12:23:13 +02:00

+- Added Hooks, only one working now is HOOKTYPE_LOCAL_QUIT

This commit is contained in:
stskeeps
2001-03-21 18:14:43 +00:00
parent 555089ce9e
commit a3a445dc77
6 changed files with 50 additions and 5 deletions
+26 -2
View File
@@ -43,11 +43,15 @@
#include "h.h"
ModuleInfo *Modules[MAXMODULES];
Hook *Hooks[MAXHOOKTYPES];
Hook *global_i = NULL;
int modules_loaded = 0;
ModuleInfo *module_buffer;
void module_init(void)
{
bzero(Modules, sizeof(Modules));
bzero(Hooks, sizeof(Hooks));
modules_loaded = 0;
}
@@ -235,7 +239,7 @@ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[])
if (parc < 3)
{
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
me.name, parv[0], "MODULES LOAD");
me.name, parv[0], "MODULE LOAD");
return 0;
}
sendto_realops("Trying to load module %s", parv[2]);
@@ -248,7 +252,7 @@ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[])
if (parc < 3)
{
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
me.name, parv[0], "MODULES UNLOAD");
me.name, parv[0], "MODULE UNLOAD");
return 0;
}
sendto_realops("Trying to unload module %s", parv[2]);
@@ -279,4 +283,24 @@ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[])
return 1;
}
void add_Hook(int hooktype, int (*func)())
{
Hook *p;
p = (Hook *) MyMallocEx(sizeof(Hook));
p->func = func;
add_ConfigItem((ConfigItem *) p, (ConfigItem **) &Hooks[hooktype]);
}
void del_Hook(int hooktype, int (*func)())
{
Hook *p;
for (p = Hooks[hooktype]; p; p = p->next)
if (p->func == func)
{
del_ConfigItem((ConfigItem *) p, (ConfigItem **) &Hooks[hooktype]);
return;
}
}