X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2Fmodules.c;h=325621e9da06820c4e47a371608cafa262b15bf4;hp=7310c88465152f21f1dc0351869489867d1346e4;hb=54ef844b721b720e9cc81dc4737c299a0e84cb59;hpb=8ce78bf760720d04385821abba8f888b5de03140 diff --git a/src/modules.c b/src/modules.c index 7310c88..325621e 100644 --- a/src/modules.c +++ b/src/modules.c @@ -22,7 +22,9 @@ /* 000-001 */ #include "main.h" /* 002-004 */ #include "tools.h" /* 005-006 */ /* deprecated */ -/* 007-011 */ /* main.h */ +/* 007-009 */ /* main.h */ +/* 010 */ #include "log.h" +/* 011 */ /* main.h */ /* 012 */ #include "BanNode.h" /* 013-019 */ #include "bots.h" /* 020-025 */ #include "ChanNode.h" @@ -67,7 +69,7 @@ void *global_functions[] = { /* 007 */ (Function) restart_bot, /* 008 */ (Function) stop_bot, /* 009 */ (Function) reload_config, -/* 010 */ (Function) putlog, +/* 010 */ (Function) printf_log, #ifdef HAVE_THREADS /* 011 */ (Function) getCurrentThreadID, #else @@ -312,7 +314,7 @@ struct ModuleInfo *loadModule(char *name) { module = dlopen(fname, RTLD_LAZY); } if(!module) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': %s not found.\n", name, fname); + printf_log("main", LOG_ERROR, "Error loading module '%s': %s not found.\n", name, fname); return NULL; } void* initfunc = dlsym(module, "init_module"); @@ -323,7 +325,7 @@ struct ModuleInfo *loadModule(char *name) { sprintf(fname, "%s.dll", name); HMODULE module = LoadLibrary(fname); if(!module) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': %s not found.\n", name, fname); + printf_log("main", LOG_ERROR, "Error loading module '%s': %s not found.\n", name, fname); return NULL; } FARPROC initfunc = GetProcAddress(module, "init_module"); @@ -332,19 +334,19 @@ struct ModuleInfo *loadModule(char *name) { FARPROC modversion = GetProcAddress(module, "modversion"); #endif if(!startfunc || !stopfunc || !modversion) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': required symbols not found.\n", name); + printf_log("main", LOG_ERROR, "Error loading module '%s': required symbols not found.\n", name); return NULL; } int version = ((int (*)(void)) modversion)(); if(version != MODULE_VERSION) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': version mismatch ('%d' main code, '%d' module)\n", name, MODULE_VERSION, version); + printf_log("main", LOG_ERROR, "Error loading module '%s': version mismatch ('%d' main code, '%d' module)\n", name, MODULE_VERSION, version); return NULL; } //start module int errid; int module_id = module_id_counter++; if((errid = ((int (*)(void **, int)) initfunc)(global_functions, module_id))) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': module reported error (errid: %d)\n", name, errid); + printf_log("main", LOG_ERROR, "Error loading module '%s': module reported error (errid: %d)\n", name, errid); return NULL; } modinfo = malloc(sizeof(*modinfo));