X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/212380e3f42f585dc1ea927402252eb943f91f7b..dc34aae05e6e299a6c53c60b728d73ecb88b21bf:/src/hook.c diff --git a/src/hook.c b/src/hook.c index 508f2d4..4f5c6ec 100644 --- a/src/hook.c +++ b/src/hook.c @@ -34,13 +34,10 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $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; @@ -61,14 +58,16 @@ int h_burst_finished; 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; 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"); @@ -86,6 +85,7 @@ init_hook(void) 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"); } /* grow_hooktable() @@ -96,10 +96,10 @@ grow_hooktable(void) { 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; } @@ -158,7 +158,7 @@ register_hook(const char *name) if((i = find_hook(name)) < 0) { i = find_freehookslot(); - DupString(hooks[i].name, name); + hooks[i].name = rb_strdup(name); num_hooks++; } @@ -176,7 +176,7 @@ add_hook(const char *name, hookfn fn) i = register_hook(name); - dlinkAddAlloc(fn, &hooks[i].hooks); + rb_dlinkAddAlloc(fn, &hooks[i].hooks); } /* remove_hook() @@ -190,7 +190,7 @@ remove_hook(const char *name, hookfn fn) if((i = find_hook(name)) < 0) return; - dlinkFindDestroy(fn, &hooks[i].hooks); + rb_dlinkFindDestroy(fn, &hooks[i].hooks); } /* call_hook() @@ -200,12 +200,12 @@ void call_hook(int id, void *arg) { hookfn fn; - dlink_node *ptr; + rb_dlink_node *ptr; /* 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);