added configuration (re)load event
authorpk910 <philipp@zoelle1.de>
Mon, 27 Aug 2012 03:49:16 +0000 (05:49 +0200)
committerpk910 <philipp@zoelle1.de>
Mon, 27 Aug 2012 04:11:07 +0000 (06:11 +0200)
src/IRCEvents.c
src/IRCEvents.h
src/main.c
src/modules.c
src/modules/module.h
src/version.h

index 2ef7f3f63679e1db208870c4702672f653c30161..b4eba22e0fcf2eab39747cd18796bc9c81c2890a 100644 (file)
@@ -48,8 +48,9 @@ static void **binds;
 #define BIND_TYPE_REGISTERED 16
 #define BIND_TYPE_FREEUSER   17
 #define BIND_TYPE_FREECHAN   18
+#define BIND_TYPE_RELOAD     19
 
-#define TOTAL_BIND_TYPES     19
+#define TOTAL_BIND_TYPES     20
 
 void init_bind() {
     binds = calloc(TOTAL_BIND_TYPES, sizeof(*binds));
@@ -221,3 +222,7 @@ FUNC_EVENT(freeuser, freeuser_func_t, BIND_TYPE_FREEUSER, (struct UserNode *user
 FUNC_BIND(freechan, freechan_func_t, BIND_TYPE_FREECHAN)
 FUNC_UNBIND(freechan, freechan_func_t, BIND_TYPE_FREECHAN)
 FUNC_EVENT(freechan, freechan_func_t, BIND_TYPE_FREECHAN, (struct ChanNode *chan), (chan))
+
+FUNC_BIND(reload, reload_func_t, BIND_TYPE_RELOAD)
+FUNC_UNBIND(reload, reload_func_t, BIND_TYPE_RELOAD)
+FUNC_EVENT(reload, reload_func_t, BIND_TYPE_RELOAD, (int initialization), (initialization))
\ No newline at end of file
index e3190378265a656bd7f2f78bda94f5eff31be1ad..2b8e9470fd141108335521dd9c1adb38a20ded94 100644 (file)
@@ -156,4 +156,11 @@ typedef int freechan_func_t(struct ChanNode *chan);
 int event_freechan(struct ChanNode *chan);
 #endif
 
+typedef int reload_func_t(int initialization);
+#ifndef DND_FUNCTIONS
+/* MODULAR ACCESSIBLE */ int bind_reload(reload_func_t *func, int module_id);
+/* MODULAR ACCESSIBLE */ void unbind_reload(reload_func_t *func);
+int event_reload(int initialization);
+#endif
+
 #endif
index 2e0e5f3da2d8d5b34bda5b7d629f05efcdfa39de..3bef6eeb08ca917c821ae6240b5c4c2d5e254264 100644 (file)
@@ -209,6 +209,7 @@ int main(int argc, char *argv[]) {
         fprintf(stderr, "Unable to load " CONF_FILE "\n");
         exit(0);
     }
+    event_reload(1);
     #if HAVE_THREADS
     THREAD_MUTEX_INIT(log_sync);
     #endif
@@ -412,6 +413,7 @@ void stop_bot() {
 
 void reload_config() {
     loadConfig(CONF_FILE);
+    event_reload(0);
 }
 
 static int getCurrentSecondsOfDay() {
index ba3562abe1209129b54a08e8edcf7042ac04580b..2b722dbb029c19cd5c8846e3b65cfc4153b0991a 100644 (file)
@@ -113,8 +113,8 @@ void *global_functions[] = {
 /* 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,
index 50207b5a8e0d29d5553f5f7a8c9eff86939f7dd8..8d8d196144cb3de77b6b4017e667e1cfb275e38a 100644 (file)
@@ -84,8 +84,8 @@ extern int module_id;
 /* 054 */ #define unbind_nick ((void (*)(nick_func_t *))global[54])
 /* 055 */ #define bind_part ((int (*)(part_func_t *, int))global[55])
 /* 056 */ #define unbind_part ((void (*)(part_func_t *))global[56])
-/* 057 */ /* deprecated */
-/* 058 */ /* deprecated */
+/* 057 */ #define bind_reload ((int (*)(reload_func_t *, int))global[57])
+/* 058 */ #define unbind_reload ((void (*)(reload_func_t *))global[58])
 /* 059 */ #define bind_kick ((int (*)(kick_func_t *, int))global[59])
 /* 060 */ #define unbind_kick ((void (*)(kick_func_t *))global[60])
 /* 061 */ #define bind_topic ((int (*)(topic_func_t *, int))global[61])
index 26a178b57f33e83f170445949efd5160513efea2..2b653c2b12e70ee1357b4834c2746d311f91e821 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "main.h"
 
-#define MODULE_VERSION 5
+#define MODULE_VERSION 6
 
 #ifndef DND_FUNCTIONS
 extern const char *compilation;