modified time-queue system and added cmd_addtimeban
[NeonServV5.git] / cmd_neonserv_delban.c
index 2bd56997609407864311d83b76bfb87ba8001490..016008bb8cb09519d495998233fa15ebfe3f75d0 100644 (file)
@@ -16,11 +16,16 @@ static CMD_BIND(neonserv_cmd_delban) {
         return;
     }
     //check if the provided mask affects any existing bans
-    printf_mysql_query("SELECT `ban_mask`, `ban_id` FROM `bans` WHERE `ban_channel` = '%d'", chan->channel_id);
+    char nameBuf[20];
+    printf_mysql_query("SELECT `ban_mask`, `ban_id`, `ban_timeout` FROM `bans` WHERE `ban_channel` = '%d'", chan->channel_id);
     res = mysql_use();
     while ((row = mysql_fetch_row(res)) != NULL) {
         if(!match(mask, row[0])) {
             //remove the ban
+            if(strcmp(row[2], "0")) {
+                sprintf(nameBuf, "ban_%s", row[1]);
+                timeq_del_name(nameBuf);
+            }
             printf_mysql_query("DELETE FROM `bans` WHERE `ban_id` = '%s'", row[1]);
             matching_bans++;
         }