X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FIRCEvents.c;h=972850249a9f2d71970bbe70922d553c9936b6c6;hb=4812835346f724fcea86e78f741cc6c72c86b676;hp=b4eba22e0fcf2eab39747cd18796bc9c81c2890a;hpb=57e7d4b1753480c4d93b79e8fa4c57f1b5a71dbd;p=NeonServV5.git diff --git a/src/IRCEvents.c b/src/IRCEvents.c index b4eba22..9728502 100644 --- a/src/IRCEvents.c +++ b/src/IRCEvents.c @@ -1,4 +1,4 @@ -/* IRCEvents.c - NeonServ v5.5 +/* IRCEvents.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -28,7 +28,7 @@ struct binding { struct binding *next; }; -static void **binds; +static void **binds = NULL; #define BIND_TYPE_JOIN 0 #define BIND_TYPE_NICK 1 #define BIND_TYPE_PART 2 @@ -49,10 +49,13 @@ static void **binds; #define BIND_TYPE_FREEUSER 17 #define BIND_TYPE_FREECHAN 18 #define BIND_TYPE_RELOAD 19 +#define BIND_TYPE_FREECLIENT 20 -#define TOTAL_BIND_TYPES 20 +#define TOTAL_BIND_TYPES 21 void init_bind() { + if(binds) + return; binds = calloc(TOTAL_BIND_TYPES, sizeof(*binds)); } @@ -66,6 +69,7 @@ void free_bind() { } } free(binds); + binds = NULL; } void unregister_module_events(int module_id) { @@ -225,4 +229,8 @@ FUNC_EVENT(freechan, freechan_func_t, BIND_TYPE_FREECHAN, (struct ChanNode *chan FUNC_BIND(reload, reload_func_t, BIND_TYPE_RELOAD) FUNC_UNBIND(reload, reload_func_t, BIND_TYPE_RELOAD) -FUNC_EVENT(reload, reload_func_t, BIND_TYPE_RELOAD, (int initialization), (initialization)) \ No newline at end of file +FUNC_EVENT(reload, reload_func_t, BIND_TYPE_RELOAD, (int initialization), (initialization)) + +FUNC_BIND(freeclient, freeclient_func_t, BIND_TYPE_FREECLIENT) +FUNC_UNBIND(freeclient, freeclient_func_t, BIND_TYPE_FREECLIENT) +FUNC_EVENT(freeclient, freeclient_func_t, BIND_TYPE_FREECLIENT, (struct ClientSocket *client), (client))