* $Id: hook.c 712 2006-02-06 04:42:14Z gxti $
*/
#include "stdinc.h"
-#include "memory.h"
-#include "tools.h"
#include "hook.h"
-#include "irc_string.h"
+#include "match.h"
hook *hooks;
int h_server_introduced;
int h_server_eob;
int h_client_exit;
+int h_umode_changed;
int h_new_local_user;
int h_new_remote_user;
int h_introduce_client;
+int h_can_kick;
+int h_privmsg_user;
+int h_privmsg_channel;
+int h_conf_read_start;
+int h_conf_read_end;
void
init_hook(void)
{
- hooks = MyMalloc(sizeof(hook) * HOOK_INCREMENT);
+ hooks = rb_malloc(sizeof(hook) * HOOK_INCREMENT);
#ifdef USE_IODEBUG_HOOKS
h_iosend_id = register_hook("iosend");
h_new_local_user = register_hook("new_local_user");
h_new_remote_user = register_hook("new_remote_user");
h_introduce_client = register_hook("introduce_client");
+ h_can_kick = register_hook("can_kick");
+ h_privmsg_user = register_hook("privmsg_user");
+ h_privmsg_channel = register_hook("privmsg_channel");
+ h_conf_read_start = register_hook("conf_read_start");
+ h_conf_read_end = register_hook("conf_read_end");
}
/* grow_hooktable()
{
hook *newhooks;
- newhooks = MyMalloc(sizeof(hook) * (max_hooks + HOOK_INCREMENT));
+ newhooks = rb_malloc(sizeof(hook) * (max_hooks + HOOK_INCREMENT));
memcpy(newhooks, hooks, sizeof(hook) * num_hooks);
- MyFree(hooks);
+ rb_free(hooks);
hooks = newhooks;
max_hooks += HOOK_INCREMENT;
}
if((i = find_hook(name)) < 0)
{
i = find_freehookslot();
- DupString(hooks[i].name, name);
+ hooks[i].name = rb_strdup(name);
num_hooks++;
}
/* The ID we were passed is the position in the hook table of this
* hook
*/
- DLINK_FOREACH(ptr, hooks[id].hooks.head)
+ RB_DLINK_FOREACH(ptr, hooks[id].hooks.head)
{
fn = ptr->data;
fn(arg);