projects
/
NeonServV5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added stats module for neonserv.krypton-bouncer.de stats
[NeonServV5.git]
/
src
/
modules.c
diff --git
a/src/modules.c
b/src/modules.c
index 0d65cb8e6eb781474c0cafbe719ad1099b1b3ac9..d024c3e186f3abb39bdf80534cf77aa3f16f2d8d 100644
(file)
--- a/
src/modules.c
+++ b/
src/modules.c
@@
-1,4
+1,4
@@
-/* modules.c - NeonServ v5.
3
+/* modules.c - NeonServ v5.
4
* 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
@@
-44,6
+44,7
@@
/* 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"
+/* 189 */ /* modules.h */
#define Function void *
#define Function void *
@@
-247,7
+248,8
@@
void *global_functions[] = {
/* 185 */ (Function) get_creation,
/* 186 */ (Function) get_revision,
/* 187 */ (Function) get_codelines,
/* 185 */ (Function) get_creation,
/* 186 */ (Function) get_revision,
/* 187 */ (Function) get_codelines,
-/* 188 */ (Function) get_patchlevel
+/* 188 */ (Function) get_patchlevel,
+/* 189 */ (Function) get_module_name
};
static int module_id_counter = 1;
};
static int module_id_counter = 1;
@@
-282,13
+284,17
@@
struct ModuleInfo *loadModule(char *name) {
#ifndef WIN32
sprintf(fname, "%s.so", name);
void* module = dlopen(fname, RTLD_LAZY);
#ifndef WIN32
sprintf(fname, "%s.so", name);
void* module = dlopen(fname, RTLD_LAZY);
+ if(!module) {
+ sprintf(fname, "./%s.so", name);
+ module = dlopen(fname, RTLD_LAZY);
+ }
if(!module) {
sprintf(fname, ".libs/%s.so", name);
module = dlopen(fname, RTLD_LAZY);
if(!module) {
sprintf(fname, ".libs/%s.so", name);
module = dlopen(fname, RTLD_LAZY);
- if(!module) {
- putlog(LOGLEVEL_ERROR, "Error loading module '%s': %s not found.\n", name, fname);
-
return NULL
;
- }
+ }
+ if(!module) {
+
putlog(LOGLEVEL_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");
}
void* initfunc = dlsym(module, "init_module");
void* startfunc = dlsym(module, "start_module");
@@
-467,3
+473,13
@@
int module_loaded(int module_id) {
}
return 0;
}
}
return 0;
}
+
+char *get_module_name(int module_id) {
+ if(!module_id) return NULL;
+ struct ModuleInfo *modinfo;
+ for(modinfo = modules; modinfo; modinfo = modinfo->next) {
+ if(modinfo->module_id == module_id)
+ return modinfo->name;
+ }
+ return NULL;
+}