Przeglądaj źródła

Limit more actions per role.

Issue #39
Bryan Drewery 10 lat temu
rodzic
commit
e973c0e0b0
2 zmienionych plików z 7 dodań i 4 usunięć
  1. 1 1
      src/flags.cc
  2. 6 3
      src/mod/irc.mod/chan.cc

+ 1 - 1
src/flags.cc

@@ -40,7 +40,7 @@ flag_t FLAG[128];
 
 struct rolecount role_counts[] = {
   {"voice",	ROLE_VOICE,	1},
-  {"flood",	ROLE_FLOOD,	2},
+  {"flood",	ROLE_FLOOD,	3},
   {"op",	ROLE_OP,	1},
   {"deop",	ROLE_DEOP,	1},
   {"kick",	ROLE_KICK,	2},

+ 6 - 3
src/mod/irc.mod/chan.cc

@@ -554,7 +554,8 @@ static bool detect_chan_flood(memberlist* m, const char *from, struct chanset_t
   /* Do not punish non-existant channel members and IRC services like
    * ChanServ
    */
-  if (!chan || (which < 0) || (which >= FLOOD_CHAN_MAX) || !m)
+  if (!chan || (which < 0) || (which >= FLOOD_CHAN_MAX) || !m ||
+      !(chan->role & ROLE_FLOOD))
     return 0;
 
   /* Okay, make sure i'm not flood-checking myself */
@@ -2815,7 +2816,8 @@ static int gotjoin(char *from, char *chname)
         bool is_op = chk_op(fr, chan);
 
         /* Check for a mass join */
-        if (!splitjoin && chan->flood_mjoin_time && chan->flood_mjoin_thr && !is_op) {
+        if (chan->role & ROLE_FLOOD &&
+            !splitjoin && chan->flood_mjoin_time && chan->flood_mjoin_thr && !is_op) {
           if (chan->channel.drone_jointime < now - chan->flood_mjoin_time) {      //expired, reset counter
             chan->channel.drone_joins = 0;
           }
@@ -2837,7 +2839,8 @@ static int gotjoin(char *from, char *chname)
 	    u_match_mask(chan->invites, from))
 	  refresh_invite(chan, from);
 
-	if (!(use_exempts && (u_match_mask(global_exempts,from) || u_match_mask(chan->exempts, from)))) {
+	if (chan->role & ROLE_BAN &&
+            !(use_exempts && (u_match_mask(global_exempts,from) || u_match_mask(chan->exempts, from)))) {
           if (channel_enforcebans(chan) && !chan_sentkick(m) && !is_op &&
               !(use_exempts && (isexempted(chan, from) || (chan->ircnet_status & CHAN_ASKED_EXEMPTS)))) {
             for (masklist* b = chan->channel.ban; b->mask[0]; b = b->next) {