rewrote IRC cache parser to be (hopefully) more stable
[NeonServV5.git] / src / modules.c
index 4372c48433d1bec7140922c977e862a754acffce..4de2468fb237d819ffc5bda26f62a91a301ea30e 100644 (file)
@@ -46,6 +46,8 @@
 /* 184-188 */ #include "version.h"
 /* 189     */ /* modules.h */
 /* 190     */ /* UserNode.h */
+/* 191-193 */ #include "ModuleFunctions.h"
+/* 194     */ /* bots.h */
 
 #define Function void *
 
@@ -111,8 +113,8 @@ void *global_functions[] = {
 /* 054 */ (Function) unbind_nick,
 /* 055 */ (Function) bind_part,
 /* 056 */ (Function) unbind_part,
-/* 057 */ (Function) bind_quit,
-/* 058 */ (Function) unbind_quit,
+/* 057 */ (Function) NULL, /* deprecated */
+/* 058 */ (Function) NULL, /* deprecated */
 /* 059 */ (Function) bind_kick,
 /* 060 */ (Function) unbind_kick,
 /* 061 */ (Function) bind_topic,
@@ -184,7 +186,7 @@ void *global_functions[] = {
 /* 120 */ (Function) find_botwise_cmd_binding,
 /* 121 */ (Function) bind_botwise_unbound_required_functions,
 /* 122 */ (Function) find_cmd_function,
-/* 123 */ (Function) getTextBot,
+/* 123 */ (Function) NULL, /* deprecated */
 /* 124 */ (Function) register_command_alias,
 /* 125 */ (Function) getAllBinds,
 /* 126 */ (Function) createModeNode,
@@ -251,7 +253,11 @@ void *global_functions[] = {
 /* 187 */ (Function) get_codelines,
 /* 188 */ (Function) get_patchlevel,
 /* 189 */ (Function) get_module_name,
-/* 190 */ (Function) isUserModeSet
+/* 190 */ (Function) isUserModeSet,
+/* 191 */ (Function) module_global_cmd_register_neonbackup,
+/* 192 */ (Function) module_global_cmd_unregister_neonbackup,
+/* 193 */ (Function) module_neonbackup_recover_chan,
+/* 194 */ (Function) requestInvite
 };
 
 static int module_id_counter = 1;
@@ -348,6 +354,7 @@ struct ModuleInfo *loadModule(char *name) {
     modinfo->state = 0;
     modinfo->next = modules;
     modules = modinfo;
+    scan_module(modinfo);
     return modinfo;
 }
 
@@ -388,6 +395,7 @@ int ext_unload_module(char *name) {
             unregister_module_hooks(old_modinfo->module_id);
             ((void (*)(int)) old_modinfo->stopfunc)(MODSTATE_STARTSTOP);
             closemodule(old_modinfo->module);
+            free_module_functions(old_modinfo);
             free(old_modinfo->name);
             free(old_modinfo);
             return 1;
@@ -410,6 +418,7 @@ int ext_reload_module(char *name) {
             unregister_module_hooks(old_modinfo->module_id);
             ((void (*)(int)) old_modinfo->stopfunc)(MODSTATE_RELOAD);
             closemodule(old_modinfo->module);
+            free_module_functions(old_modinfo);
             free(old_modinfo->name);
             free(old_modinfo);
             break;
@@ -456,6 +465,7 @@ void stop_modules() {
         unregister_module_hooks(modinfo->module_id);
         ((void (*)(int)) modinfo->stopfunc)(MODSTATE_STARTSTOP);
         closemodule(modinfo->module);
+        free_module_functions(modinfo);
         free(modinfo->name);
         free(modinfo);
     }
@@ -466,6 +476,7 @@ static void unregister_module_hooks(int module_id) {
     unregister_module_commands(module_id);
     unregister_module_events(module_id);
     unregister_module_timers(module_id);
+    
 }
 
 int module_loaded(int module_id) {
@@ -487,3 +498,5 @@ char *get_module_name(int module_id) {
     }
     return NULL;
 }
+
+