Przeglądaj źródła

Merge branch 'flood-tweaks'

* flood-tweaks:
  Update default flood settings
  Don't punish words 6 chars or less for CAPS
  Only bail out of offense check if there's no color check as well
Bryan Drewery 14 lat temu
rodzic
commit
8094d5b12f

+ 16 - 16
src/mod/channels.mod/chanmisc.c

@@ -1096,27 +1096,27 @@ int channel_add(char *result, const char *newname, char *options, bool isdefault
     chan->knock_flags = 0;
     chan->flood_lock_time = 120;
     chan->flood_exempt_mode = 0;
-    chan->flood_pub_thr = gfld_chan_thr;
-    chan->flood_pub_time = gfld_chan_time;
-    chan->flood_bytes_thr = gfld_bytes_thr;
-    chan->flood_bytes_time = gfld_bytes_time;
-    chan->flood_ctcp_thr = gfld_ctcp_thr;
-    chan->flood_ctcp_time = gfld_ctcp_time;
-    chan->flood_join_thr = gfld_join_thr;
-    chan->flood_join_time = gfld_join_time;
-    chan->flood_deop_thr = gfld_deop_thr;
-    chan->flood_deop_time = gfld_deop_time;
-    chan->flood_kick_thr = gfld_kick_thr;
-    chan->flood_kick_time = gfld_kick_time;
-    chan->flood_nick_thr = gfld_nick_thr;
-    chan->flood_nick_time = gfld_nick_time;
+    chan->flood_pub_thr = 0;
+    chan->flood_pub_time = 0;
+    chan->flood_bytes_thr = 0;
+    chan->flood_bytes_time = 0;
+    chan->flood_ctcp_thr = 5;
+    chan->flood_ctcp_time = 30;
+    chan->flood_join_thr = 0;
+    chan->flood_join_time = 0;
+    chan->flood_deop_thr = 8;
+    chan->flood_deop_time = 10;
+    chan->flood_kick_thr = 0;
+    chan->flood_kick_time = 0;
+    chan->flood_nick_thr = 0;
+    chan->flood_nick_time = 0;
     chan->flood_mjoin_thr = 6;
     chan->flood_mjoin_time = 1;
     chan->capslimit = 0;
     chan->colorlimit = 0;
-    chan->flood_mpub_thr = 10;
+    chan->flood_mpub_thr = 20;
     chan->flood_mpub_time = 1;
-    chan->flood_mbytes_thr = 500;
+    chan->flood_mbytes_thr = 1000;
     chan->flood_mbytes_time = 1;
     chan->flood_mctcp_thr = 7;
     chan->flood_mctcp_time = 1;

+ 0 - 16
src/mod/channels.mod/channels.c

@@ -61,22 +61,6 @@ static interval_t 			global_invite_time;
 
 static char *lastdeletedmask = NULL;
 
-/* Global flood settings */
-static int 			gfld_chan_thr;
-static interval_t 		gfld_chan_time;
-static int 			gfld_bytes_thr;
-static interval_t 		gfld_bytes_time;
-static int 			gfld_deop_thr = 8;
-static interval_t 		gfld_deop_time = 10;
-static int 			gfld_kick_thr;
-static interval_t 		gfld_kick_time;
-static int 			gfld_join_thr;
-static interval_t 		gfld_join_time;
-static int 			gfld_ctcp_thr = 5;
-static interval_t 		gfld_ctcp_time = 30;
-static int			gfld_nick_thr;
-static interval_t		gfld_nick_time;
-
 static int 			killed_bots = 0;
 
 #include "channels.h"

+ 4 - 5
src/mod/irc.mod/irc.c

@@ -146,12 +146,11 @@ detect_offense(memberlist* m, struct chanset_t *chan, char *msg)
       ++msg_check;
     }
 
-    if (!tot) {
-      return 0;
-    }
-
     if (tot >= 30) {
       hit_check = tot/5; //check in-between for hits to save waste of cpu
+    } else if (!tot && !chan->colorlimit) {
+      // Nothing to do, bail out
+      return 0;
     }
   }
 
@@ -182,7 +181,7 @@ detect_offense(memberlist* m, struct chanset_t *chan, char *msg)
     }
     ++msg;
   }
-  if (chan->capslimit && caps_count) {
+  if (chan->capslimit && caps_count && tot >= 6) {
     caps_percentage = (caps_count)/(double(tot));
     if (caps_percentage >= caps_limit) {
       putlog(LOG_MODES, chan->name, "Caps flood (%d%%) from %s -- kicking", int(caps_percentage * 100), m->nick);