added OPER support (let the bots try to op themselves)
[NeonServV5.git] / src / modules.c
index adbe37df4a4cd16432e45ed90e636b67a9401b51..4372c48433d1bec7140922c977e862a754acffce 100644 (file)
@@ -44,6 +44,8 @@
 /* 170-180 */ #include "UserNode.h"
 /* 181-183 */ #include "WHOHandler.h"
 /* 184-188 */ #include "version.h"
+/* 189     */ /* modules.h */
+/* 190     */ /* UserNode.h */
 
 #define Function void *
 
@@ -247,7 +249,9 @@ void *global_functions[] = {
 /* 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,
+/* 190 */ (Function) isUserModeSet
 };
 
 static int module_id_counter = 1;
@@ -257,6 +261,7 @@ static void unregister_module_hooks(int module_id);
 
 void loadModules() {
     char **modulelist = get_all_fieldnames("modules");
+    if(!modulelist) return;
     int i = 0;
     char tmp[MAXLEN];
     struct ModuleInfo *modinfo;
@@ -270,6 +275,7 @@ void loadModules() {
         }
         i++;
     }
+    free(modulelist);
     start_modules();
 }
 
@@ -471,3 +477,13 @@ int module_loaded(int module_id) {
     }
     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;
+}