X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FHandleInfoHandler.c;h=edbf95b4aae6cbc7ec2cdaa58409345e86ff2cc9;hb=4812835346f724fcea86e78f741cc6c72c86b676;hp=0508e07413448c82c7dc22f2661b364d333db646;hpb=c32e8254ec4ed0d77757e32f8aa5aabcdb494057;p=NeonServV5.git diff --git a/src/HandleInfoHandler.c b/src/HandleInfoHandler.c index 0508e07..edbf95b 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,7 @@ #include "ChanNode.h" #include "IRCEvents.h" #include "tools.h" +#include "modules.h" #define AUTHSERV_NICK "AuthServ" @@ -29,6 +30,7 @@ struct HandleInfoQueueEntry { char *auth; void *callback[MAXCALLBACKS]; + int module_id[MAXCALLBACKS]; void *data[MAXCALLBACKS]; struct HandleInfoQueueEntry *next; @@ -79,7 +81,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 +91,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 +106,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; @@ -207,7 +211,7 @@ static void recv_notice(struct UserNode *user, struct UserNode *target, char *me if(do_match) { #ifdef HAVE_THREADS - unsigned long tid = syscall(SYS_gettid); + unsigned int tid = (unsigned int) pthread_self_tid(); while(!clientsocket_parseorder_top(tid)) { usleep(1000); //1ms } @@ -224,7 +228,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 +238,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() {