Another year is about to end... So we have to update these damn copyright information :P
[NeonServV5.git] / src / IRCEvents.c
index 99e28fdde26efee8311af5ee0615903e1a700985..cc59f74308ce97880afd8e2dbe26df3c0c869ae5 100644 (file)
@@ -1,5 +1,5 @@
-/* IRCEvents.c - NeonServ v5.1
- * Copyright (C) 2011  Philipp Kreil (pk910)
+/* IRCEvents.c - NeonServ v5.3
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,8 +44,11 @@ static void **binds;
 #define BIND_TYPE_INVITE     13
 #define BIND_TYPE_RAW        14
 #define BIND_TYPE_BOT_READY  15
+#define BIND_TYPE_REGISTERED 16
+#define BIND_TYPE_FREEUSER   17
+#define BIND_TYPE_FREECHAN   18
 
-#define TOTAL_BIND_TYPES     16
+#define TOTAL_BIND_TYPES     19
 
 void init_bind() {
     binds = calloc(TOTAL_BIND_TYPES, sizeof(*binds));
@@ -189,3 +192,25 @@ FUNC_EVENT(raw, raw_func_t, BIND_TYPE_RAW, (struct ClientSocket *client, char *f
 FUNC_BIND(bot_ready, bot_ready_func_t, BIND_TYPE_BOT_READY)
 FUNC_UNBIND(bot_ready, bot_ready_func_t, BIND_TYPE_BOT_READY)
 FUNC_EVENT(bot_ready, bot_ready_func_t, BIND_TYPE_BOT_READY, (struct ClientSocket *client), (client))
+
+FUNC_BIND(registered, registered_func_t, BIND_TYPE_REGISTERED)
+FUNC_UNBIND(registered, registered_func_t, BIND_TYPE_REGISTERED)
+int event_registered(struct UserNode *old_user, struct UserNode *new_user) {
+    struct binding *cbind;
+    int ret = 0;
+    pre_event(BIND_TYPE_REGISTERED);
+    for(cbind = binds[BIND_TYPE_REGISTERED]; cbind; cbind = cbind->next) {
+        registered_func_t *func = cbind->func;
+        ret |= func(old_user, new_user);
+    }
+    post_event(BIND_TYPE_REGISTERED);
+    return ret;
+}
+
+FUNC_BIND(freeuser, freeuser_func_t, BIND_TYPE_FREEUSER)
+FUNC_UNBIND(freeuser, freeuser_func_t, BIND_TYPE_FREEUSER)
+FUNC_EVENT(freeuser, freeuser_func_t, BIND_TYPE_FREEUSER, (struct UserNode *user), (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))