X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FHandleInfoHandler.c;h=8a8a46ce3a0ce205b422c01907c28f62c9e78835;hp=6e5415ffe40381af7b894b72cc37f97d512a156a;hb=HEAD;hpb=2b9e305af713f0960ac0cd7645af3e0ef85a8515 diff --git a/src/HandleInfoHandler.c b/src/HandleInfoHandler.c index 6e5415f..8a8a46c 100644 --- a/src/HandleInfoHandler.c +++ b/src/HandleInfoHandler.c @@ -1,4 +1,4 @@ -/* HandleInfoHandler.c - NeonServ v5.3 +/* HandleInfoHandler.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -21,6 +21,8 @@ #include "ChanNode.h" #include "IRCEvents.h" #include "tools.h" +#include "modules.h" +#include "log.h" #define AUTHSERV_NICK "AuthServ" @@ -29,6 +31,7 @@ struct HandleInfoQueueEntry { char *auth; void *callback[MAXCALLBACKS]; + int module_id[MAXCALLBACKS]; void *data[MAXCALLBACKS]; struct HandleInfoQueueEntry *next; @@ -38,7 +41,7 @@ static struct HandleInfoQueueEntry* addHandleInfoQueueEntry(struct ClientSocket struct HandleInfoQueueEntry *entry = malloc(sizeof(*entry)); if (!entry) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return NULL; } SYNCHRONIZE(cache_sync); @@ -79,7 +82,7 @@ void clear_handleinfoqueue(struct ClientSocket *client) { DESYNCHRONIZE(cache_sync); } -void lookup_authname(char *auth, authlookup_callback_t callback, void *data) { +void lookup_authname(char *auth, int module_id, authlookup_callback_t callback, void *data) { struct ClientSocket *bot; struct HandleInfoQueueEntry* entry; for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { @@ -89,6 +92,7 @@ void lookup_authname(char *auth, authlookup_callback_t callback, void *data) { for(i = 1; i < MAXCALLBACKS; i++) { if(!entry->callback[i]) { entry->callback[i] = callback; + entry->module_id[i] = module_id; entry->data[i] = data; return; } @@ -103,6 +107,7 @@ void lookup_authname(char *auth, authlookup_callback_t callback, void *data) { int i; entry->auth = strdup(auth); entry->callback[0] = callback; + entry->module_id[0] = module_id; for(i = 1; i < MAXCALLBACKS; i++) entry->callback[i] = NULL; entry->data[0] = data; @@ -224,7 +229,8 @@ static void recv_notice(struct UserNode *user, struct UserNode *target, char *me for(i = 0; i < MAXCALLBACKS; i++) { callback = entry->callback[i]; if(!callback) break; - callback(entry->auth, exists, registered, entry->data[i]); + if(!entry->module_id[i] || module_loaded(entry->module_id[i])) + callback(entry->auth, exists, registered, entry->data[i]); } free(entry->auth); free(entry); @@ -233,7 +239,7 @@ static void recv_notice(struct UserNode *user, struct UserNode *target, char *me } void init_handleinfohandler() { - bind_privnotice(recv_notice); + bind_privnotice(recv_notice, 0); } void free_handleinfohandler() {