added spam/flood punishments
[NeonServV5.git] / src / bot_NeonSpam.c
index 226348897c78b0bd35298803c255d5463f21a0d8..d4a10d44fcd27b64e0366952d0d5a33f459d3689 100644 (file)
@@ -118,6 +118,7 @@ static void start_bots() {
 }
 
 static int loadNeonSpamSettings(struct ChanNode *chan) {
+    if(chan->spam_settings) return 0;
     struct NeonSpamSettings *settings = malloc(sizeof(*settings));
     if(!settings) {
         perror("malloc() failed");
@@ -125,11 +126,11 @@ static int loadNeonSpamSettings(struct ChanNode *chan) {
     }
     MYSQL_RES *res;
     MYSQL_ROW row, defaults = NULL;
-    printf_mysql_query("SELECT `channel_scanstate`, `channel_maxrepeat`, `channel_maxflood`, `channel_floodtime`, `channel_maxjoin`, `channel_jointime` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
+    printf_mysql_query("SELECT `channel_scanstate`, `channel_maxrepeat`, `channel_maxflood`, `channel_floodtime`, `channel_maxjoin`, `channel_jointime`, `channel_scanexcept` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
     res = mysql_use();
     row = mysql_fetch_row(res);
     if(!row[0] || !row[1] || !row[2] || !row[3] || !row[4] || !row[5]) {
-        printf_mysql_query("SELECT `channel_scanstate`, `channel_maxrepeat`, `channel_maxflood`, `channel_floodtime`, `channel_maxjoin`, `channel_jointime` FROM `channels` WHERE `channel_name` = 'defaults'");
+        printf_mysql_query("SELECT `channel_scanstate`, `channel_maxrepeat`, `channel_maxflood`, `channel_floodtime`, `channel_maxjoin`, `channel_jointime`, `channel_scanexcept` FROM `channels` WHERE `channel_name` = 'defaults'");
         res = mysql_use();
         defaults = mysql_fetch_row(res);
     }
@@ -139,6 +140,7 @@ static int loadNeonSpamSettings(struct ChanNode *chan) {
     settings->flood_time = atoi(row[3] ? row[3] : defaults[3]);
     settings->join_amount = atoi(row[4] ? row[4] : defaults[4]);
     settings->join_time = atoi(row[5] ? row[5] : defaults[5]);
+    settings->exceptlevel = atoi(row[6] ? row[6] : defaults[6]);
     chan->spam_settings = settings;
     return 1;
 }