modified code to use IOHandler functions instead of own ones
[NeonServV5.git] / src / modules / NeonFun.mod / bot_NeonFun.c
index 49364a2134d6fad22c446f3ac2c9ad4c9f33d233..b0c2cae65f57d2293a66298117a5956741123082 100644 (file)
@@ -1,4 +1,4 @@
-/* bot_NeonFun.c - NeonServ v5.4
+/* bot_NeonFun.c - NeonServ v5.5
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -44,6 +44,8 @@
 #define BOTALIAS "NeonFun"
 
 static void neonfun_bot_ready(struct ClientSocket *client) {
+    if(client->botid != BOTID)
+        return;
     MYSQL_RES *res;
     MYSQL_ROW row;
     
@@ -99,7 +101,7 @@ static void start_bots(int type) {
             client->flags |= (strcmp(row[8], "0") ? SOCKET_FLAG_USE_QUEUE : 0);
             client->flags |= (strcmp(row[9], "0") ? SOCKET_FLAG_SSL : 0);
             client->flags |= SOCKET_FLAG_SILENT;
-            client->flags |= SOCKET_FLAG_REQUEST_INVITE;
+            client->flags |= SOCKET_FLAG_REQUEST_INVITE | SOCKET_FLAG_REQUEST_OP;
             client->botid = BOTID;
             client->clientid = atoi(row[7]);
             connect_socket(client);
@@ -126,16 +128,11 @@ static void start_bots(int type) {
     bind_unbound_required_functions(BOTID);
 }
 
-static void neonfun_parted(struct ChanUser *chanuser, char *reason) {
+static void neonfun_parted(struct ChanUser *chanuser, int quit, char *reason) {
     uno_event_part(chanuser);
     fourwins_event_part(chanuser);
 }
 
-static void neonfun_quitted(struct UserNode *user, char *reason) {
-    uno_event_quit(user);
-    fourwins_event_quit(user);
-}
-
 static int neonfun_freechan(struct ChanNode *chan) {
     uno_event_freechan(chan);
     fourwins_event_freechan(chan);
@@ -181,17 +178,12 @@ void init_NeonFun(int type) {
     //register events
     bind_bot_ready(neonfun_bot_ready, module_id);
     bind_part(neonfun_parted, module_id);
-    bind_quit(neonfun_quitted, module_id);
     bind_freechan(neonfun_freechan, module_id);
     bind_invite(neonfun_event_invite, module_id);
        
     set_trigger_callback(BOTID, module_id, neonfun_trigger_callback);
 }
 
-void loop_NeonFun() {
-    
-}
-
 void free_NeonFun(int type) {
     unbind_allcmd(BOTID);
     if(type == MODSTATE_STARTSTOP) {