*** VERSION 5.6.0 ***
[NeonServV5.git] / src / IRCEvents.c
index 2ef7f3f63679e1db208870c4702672f653c30161..fc5053ffa68e4df71a061a3768bd94c3a58076c1 100644 (file)
@@ -1,4 +1,4 @@
-/* IRCEvents.c - NeonServ v5.5
+/* IRCEvents.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -28,7 +28,7 @@ struct binding {
     struct binding *next;
 };
 
-static void **binds;
+static void **binds = NULL;
 #define BIND_TYPE_JOIN       0
 #define BIND_TYPE_NICK       1
 #define BIND_TYPE_PART       2
@@ -48,10 +48,13 @@ 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() {
+    if(binds)
+        return;
     binds = calloc(TOTAL_BIND_TYPES, sizeof(*binds));
 }
 
@@ -65,6 +68,7 @@ void free_bind() {
         }
     }
     free(binds);
+    binds = NULL;
 }
 
 void unregister_module_events(int module_id) {
@@ -221,3 +225,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))