added new multi log system
[NeonServV5.git] / src / modules / NeonSpam.mod / bot_NeonSpam.c
index 3e714accdc849cea253737604073fe54e484e452..dd2e4d1043fc722ecdabd593808150fba2fda330 100644 (file)
@@ -1,4 +1,4 @@
-/* bot_NeonSpam.c - NeonServ v5.5
+/* bot_NeonSpam.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -152,7 +152,7 @@ static void start_bots(int type) {
     MYSQL_ROW row;
     
     if(type == MODSTATE_STARTSTOP) {
-        printf_mysql_query("SELECT `nick`, `ident`, `realname`, `server`, `port`, `pass`, `textbot`, `id`, `queue`, `ssl`, `bind` FROM `bots` WHERE `botclass` = '%d' AND `active` = '1'", BOTID);
+        printf_mysql_query("SELECT `nick`, `ident`, `realname`, `server`, `port`, `pass`, `textbot`, `id`, `queue`, `ssl`, `bind`, `secret` FROM `bots` WHERE `botclass` = '%d' AND `active` = '1'", BOTID);
         res = mysql_use();
         
         while ((row = mysql_fetch_row(res)) != NULL) {
@@ -160,6 +160,7 @@ static void start_bots(int type) {
             client->flags |= (strcmp(row[6], "0") ? SOCKET_FLAG_PREFERRED : 0);
             client->flags |= (strcmp(row[8], "0") ? SOCKET_FLAG_USE_QUEUE : 0);
             client->flags |= (strcmp(row[9], "0") ? SOCKET_FLAG_SSL : 0);
+            client->flags |= (strcmp(row[11], "0") ? SOCKET_FLAG_SECRET_BOT : 0);
             client->flags |= SOCKET_FLAG_REQUEST_INVITE | SOCKET_FLAG_REQUEST_OP;
             client->botid = BOTID;
             client->clientid = atoi(row[7]);
@@ -224,7 +225,7 @@ int loadNeonSpamSettings(struct ChanNode *chan) {
     if(chan->spam_settings) return 0;
     struct NeonSpamSettings *settings = malloc(sizeof(*settings));
     if(!settings) {
-        perror("malloc() failed");
+        printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return 0;
     }
     MYSQL_RES *res;
@@ -320,7 +321,7 @@ static struct NeonSpamJoinNode *getNeonSpamJoinNode(struct ChanUser *chanuser) {
         return result;
     joinnode = malloc(sizeof(*joinnode));
     if(!joinnode) {
-        perror("malloc() failed");
+        printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return NULL;
     }
     joinnode->ident = strdup(chanuser->user->ident);
@@ -335,7 +336,7 @@ static struct NeonSpamJoinNode *getNeonSpamJoinNode(struct ChanUser *chanuser) {
 static void createSpamNode(struct ChanUser *chanuser) {
     struct NeonSpamNode *spamnode = malloc(sizeof(*spamnode));
     if(!spamnode) {
-        perror("malloc() failed");
+        printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return;
     }
     spamnode->lastmsg = 0;
@@ -401,10 +402,6 @@ void init_NeonSpam(int type) {
     register_default_language_table(msgtab);
 }
 
-void loop_NeonSpam() {
-    
-}
-
 void free_NeonSpam(int type) {
     unbind_allcmd(BOTID);
     if(type == MODSTATE_STARTSTOP) {