X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FIRCEvents.c;h=2eea34d8ecc1067bddf693e2a721b6a748abeee7;hp=fc5053ffa68e4df71a061a3768bd94c3a58076c1;hb=HEAD;hpb=fc61be208ca6dbf2fd915591c8dc7e5ef5779891 diff --git a/src/IRCEvents.c b/src/IRCEvents.c index fc5053f..2eea34d 100644 --- a/src/IRCEvents.c +++ b/src/IRCEvents.c @@ -21,6 +21,7 @@ #include "ChanUser.h" #include "ClientSocket.h" #include "mysqlConn.h" +#include "log.h" struct binding { void *func; @@ -49,8 +50,9 @@ static void **binds = NULL; #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) @@ -104,7 +106,7 @@ int bind_##NAME(FUNCTYPE *func, int module_id) { \ if(!is_bound(TYPE, func)) { \ struct binding *cbind = malloc(sizeof(*cbind)); \ if (!cbind) { \ - perror("malloc() failed"); \ + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); \ return 0; \ } \ cbind->func = func; \ @@ -229,3 +231,7 @@ 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)) + +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))