projects
/
NeonServV5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed language format string fail
[NeonServV5.git]
/
src
/
modules.c
diff --git
a/src/modules.c
b/src/modules.c
index ba3562abe1209129b54a08e8edcf7042ac04580b..f48c41a0b2b0eda7a55987eda7522398057f807f 100644
(file)
--- a/
src/modules.c
+++ b/
src/modules.c
@@
-1,4
+1,4
@@
-/* modules.c - NeonServ v5.
5
+/* modules.c - NeonServ v5.
6
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
@@
-19,7
+19,14
@@
#include <dlfcn.h>
#endif
#include <dlfcn.h>
#endif
-/* 000-011 */ #include "main.h"
+/* 000-001 */ #include "main.h"
+/* 002-004 */ #include "tools.h"
+#ifdef ENABLE_MUTEX_DEBUG
+/* 005-006 */ #include "mutexDebug.h"
+#endif
+/* 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"
/* 012 */ #include "BanNode.h"
/* 013-019 */ #include "bots.h"
/* 020-025 */ #include "ChanNode.h"
@@
-36,11
+43,13
@@
/* 099-102 */ #include "memoryDebug.h"
#endif
/* 103-106 */ #include "memoryInfo.h"
/* 099-102 */ #include "memoryDebug.h"
#endif
/* 103-106 */ #include "memoryInfo.h"
-/* 107-125 */ #include "modcmd.h"
+/* 107-122 */ #include "modcmd.h"
+/* 123 */ /* deprecated */
+/* 124-125 */ /* modcmd.h */
/* 126-136 */ #include "ModeNode.h"
/* 137-142 */ #include "mysqlConn.h"
/* 143-149 */ #include "timeq.h"
/* 126-136 */ #include "ModeNode.h"
/* 137-142 */ #include "mysqlConn.h"
/* 143-149 */ #include "timeq.h"
-/* 150-169 */
#include "tools.h"
+/* 150-169 */
/* tools.h */
/* 170-180 */ #include "UserNode.h"
/* 181-183 */ #include "WHOHandler.h"
/* 184-188 */ #include "version.h"
/* 170-180 */ #include "UserNode.h"
/* 181-183 */ #include "WHOHandler.h"
/* 184-188 */ #include "version.h"
@@
-48,21
+57,28
@@
/* 190 */ /* UserNode.h */
/* 191-193 */ #include "ModuleFunctions.h"
/* 194 */ /* bots.h */
/* 190 */ /* UserNode.h */
/* 191-193 */ #include "ModuleFunctions.h"
/* 194 */ /* bots.h */
+/* 195-196 */ /* version.h */
+/* 197-198 */ /* IRCEvents.h */
#define Function void *
void *global_functions[] = {
/* 000 */ (Function) getStartTime,
/* 001 */ (Function) getRunningThreads,
#define Function void *
void *global_functions[] = {
/* 000 */ (Function) getStartTime,
/* 001 */ (Function) getRunningThreads,
-/* 002 */ (Function)
exit_daemon
,
+/* 002 */ (Function)
getCurrentSecondsOfDay
,
/* 003 */ (Function) stricmp,
/* 004 */ (Function) stricmplen,
/* 003 */ (Function) stricmp,
/* 004 */ (Function) stricmplen,
-/* 005 */ (Function) restart_process,
-/* 006 */ (Function) cleanup,
+#ifdef ENABLE_MUTEX_DEBUG
+/* 005 */ (Function) xmutex,
+/* 006 */ (Function) mutex_debug,
+#else
+/* 005 */ (Function) NULL,
+/* 006 */ (Function) NULL,
+#endif
/* 007 */ (Function) restart_bot,
/* 008 */ (Function) stop_bot,
/* 009 */ (Function) reload_config,
/* 007 */ (Function) restart_bot,
/* 008 */ (Function) stop_bot,
/* 009 */ (Function) reload_config,
-/* 010 */ (Function) p
ut
log,
+/* 010 */ (Function) p
rintf_
log,
#ifdef HAVE_THREADS
/* 011 */ (Function) getCurrentThreadID,
#else
#ifdef HAVE_THREADS
/* 011 */ (Function) getCurrentThreadID,
#else
@@
-89,7
+105,7
@@
void *global_functions[] = {
/* 030 */ (Function) create_socket,
/* 031 */ (Function) connect_socket,
/* 032 */ (Function) close_socket,
/* 030 */ (Function) create_socket,
/* 031 */ (Function) connect_socket,
/* 032 */ (Function) close_socket,
-/* 033 */ (Function) d
isconnect
_socket,
+/* 033 */ (Function) d
estroy
_socket,
/* 034 */ (Function) write_socket,
/* 035 */ (Function) putsock,
/* 036 */ (Function) getBots,
/* 034 */ (Function) write_socket,
/* 035 */ (Function) putsock,
/* 036 */ (Function) getBots,
@@
-113,8
+129,8
@@
void *global_functions[] = {
/* 054 */ (Function) unbind_nick,
/* 055 */ (Function) bind_part,
/* 056 */ (Function) unbind_part,
/* 054 */ (Function) unbind_nick,
/* 055 */ (Function) bind_part,
/* 056 */ (Function) unbind_part,
-/* 057 */ (Function)
NULL, /* deprecated */
-/* 058 */ (Function)
NULL, /* deprecated */
+/* 057 */ (Function)
bind_reload,
+/* 058 */ (Function)
unbind_reload,
/* 059 */ (Function) bind_kick,
/* 060 */ (Function) unbind_kick,
/* 061 */ (Function) bind_topic,
/* 059 */ (Function) bind_kick,
/* 060 */ (Function) unbind_kick,
/* 061 */ (Function) bind_topic,
@@
-257,7
+273,11
@@
void *global_functions[] = {
/* 191 */ (Function) module_global_cmd_register_neonbackup,
/* 192 */ (Function) module_global_cmd_unregister_neonbackup,
/* 193 */ (Function) module_neonbackup_recover_chan,
/* 191 */ (Function) module_global_cmd_register_neonbackup,
/* 192 */ (Function) module_global_cmd_unregister_neonbackup,
/* 193 */ (Function) module_neonbackup_recover_chan,
-/* 194 */ (Function) requestInvite
+/* 194 */ (Function) requestInvite,
+/* 195 */ (Function) is_stable_revision,
+/* 196 */ (Function) get_dev_revision,
+/* 197 */ (Function) bind_freeclient,
+/* 198 */ (Function) unbind_freeclient
};
static int module_id_counter = 1;
};
static int module_id_counter = 1;
@@
-303,41
+323,39
@@
struct ModuleInfo *loadModule(char *name) {
module = dlopen(fname, RTLD_LAZY);
}
if(!module) {
module = dlopen(fname, RTLD_LAZY);
}
if(!module) {
- p
utlog(LOGLEVEL
_ERROR, "Error loading module '%s': %s not found.\n", name, fname);
+ p
rintf_log("main", LOG
_ERROR, "Error loading module '%s': %s not found.\n", name, fname);
return NULL;
}
void* initfunc = dlsym(module, "init_module");
void* startfunc = dlsym(module, "start_module");
return NULL;
}
void* initfunc = dlsym(module, "init_module");
void* startfunc = dlsym(module, "start_module");
- void* loopfunc = dlsym(module, "loop_module");
void* stopfunc = dlsym(module, "stop_module");
void* modversion = dlsym(module, "modversion");
#else
sprintf(fname, "%s.dll", name);
HMODULE module = LoadLibrary(fname);
if(!module) {
void* stopfunc = dlsym(module, "stop_module");
void* modversion = dlsym(module, "modversion");
#else
sprintf(fname, "%s.dll", name);
HMODULE module = LoadLibrary(fname);
if(!module) {
- p
utlog(LOGLEVEL
_ERROR, "Error loading module '%s': %s not found.\n", name, fname);
+ p
rintf_log("main", LOG
_ERROR, "Error loading module '%s': %s not found.\n", name, fname);
return NULL;
}
FARPROC initfunc = GetProcAddress(module, "init_module");
FARPROC startfunc = GetProcAddress(module, "start_module");
return NULL;
}
FARPROC initfunc = GetProcAddress(module, "init_module");
FARPROC startfunc = GetProcAddress(module, "start_module");
- FARPROC loopfunc = GetProcAddress(module, "loop_module");
FARPROC stopfunc = GetProcAddress(module, "stop_module");
FARPROC modversion = GetProcAddress(module, "modversion");
#endif
FARPROC stopfunc = GetProcAddress(module, "stop_module");
FARPROC modversion = GetProcAddress(module, "modversion");
#endif
- if(!startfunc || !
loopfunc || !
stopfunc || !modversion) {
- p
utlog(LOGLEVEL
_ERROR, "Error loading module '%s': required symbols not found.\n", name);
+ if(!startfunc || !stopfunc || !modversion) {
+ p
rintf_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) {
return NULL;
}
int version = ((int (*)(void)) modversion)();
if(version != MODULE_VERSION) {
- p
utlog(LOGLEVEL
_ERROR, "Error loading module '%s': version mismatch ('%d' main code, '%d' module)\n", name, MODULE_VERSION, version);
+ p
rintf_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))) {
return NULL;
}
//start module
int errid;
int module_id = module_id_counter++;
if((errid = ((int (*)(void **, int)) initfunc)(global_functions, module_id))) {
- p
utlog(LOGLEVEL
_ERROR, "Error loading module '%s': module reported error (errid: %d)\n", name, errid);
+ p
rintf_log("main", LOG
_ERROR, "Error loading module '%s': module reported error (errid: %d)\n", name, errid);
return NULL;
}
modinfo = malloc(sizeof(*modinfo));
return NULL;
}
modinfo = malloc(sizeof(*modinfo));
@@
-349,7
+367,6
@@
struct ModuleInfo *loadModule(char *name) {
modinfo->module_id = module_id;
modinfo->module = module;
modinfo->startfunc = startfunc;
modinfo->module_id = module_id;
modinfo->module = module;
modinfo->startfunc = startfunc;
- modinfo->loopfunc = loopfunc;
modinfo->stopfunc = stopfunc;
modinfo->state = 0;
modinfo->next = modules;
modinfo->stopfunc = stopfunc;
modinfo->state = 0;
modinfo->next = modules;
@@
-451,13
+468,6
@@
void start_modules() {
}
}
}
}
-void loop_modules() {
- struct ModuleInfo *modinfo;
- for(modinfo = modules; modinfo; modinfo = modinfo->next) {
- ((void (*)(void)) modinfo->loopfunc)();
- }
-}
-
void stop_modules() {
struct ModuleInfo *modinfo, *next;
for(modinfo = modules; modinfo; modinfo = next) {
void stop_modules() {
struct ModuleInfo *modinfo, *next;
for(modinfo = modules; modinfo; modinfo = next) {