Przeglądaj źródła

* Properly honor exemptions when kicking matched RBL clients

Bryan Drewery 16 lat temu
rodzic
commit
f1f8b5ec38
2 zmienionych plików z 21 dodań i 12 usunięć
  1. 1 0
      doc/UPDATES
  2. 20 12
      src/mod/irc.mod/chan.c

+ 1 - 0
doc/UPDATES

@@ -1,4 +1,5 @@
 * Fix crash related to slowpart
+* Properly honor exemptions when kicking matched RBL clients
 
 1.3 - http://wraith.botpack.net/milestone/1.3
 * Binary / shell / startup changes

+ 20 - 12
src/mod/irc.mod/chan.c

@@ -130,21 +130,29 @@ static void resolve_rbl_callback(int id, void *client_data, const char *host, bd
 
   bd::String reason = "Listed in RBL: " + *(r->server);
 
-  u_addmask('b', chan, s1, conf.bot->nick, reason.c_str(), now + (60 * (chan->ban_time ? chan->ban_time : 300)), 0);
+  if (!(use_exempts && (u_match_mask(global_exempts, s1) || u_match_mask(chan->exempts, s1)))) {
 
-  if (me_op(chan)) {
-    do_mask(chan, chan->channel.ban, s1, 'b');
+    u_addmask('b', chan, s1, conf.bot->nick, reason.c_str(), now + (60 * (chan->ban_time ? chan->ban_time : 300)), 0);
 
-    memberlist *m = NULL;
-    char *pe = NULL;
+    if (me_op(chan)) {
+      do_mask(chan, chan->channel.ban, s1, 'b');
 
-    /* Apply lookup results to all matching members by host */
-    for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-      if (!m->user && !chan_sentkick(m) && m->userip[0]) {
-        pe = strchr(m->userip, '@');
-        if (pe && !strcmp(pe + 1, r->host)) {
-          m->flags |= SENTKICK;
-          dprintf(DP_MODE, "KICK %s %s :%s%s\n", chan->name, m->nick, bankickprefix, reason.c_str());
+      memberlist *m = NULL;
+      char *pe = NULL;
+
+      /* Apply lookup results to all matching members by host */
+      for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+        if (!m->user && !chan_sentkick(m) && m->userip[0]) {
+          pe = strchr(m->userip, '@');
+          if (pe && !strcmp(pe + 1, r->host)) {
+            simple_snprintf(s1, sizeof(s1), "%s!%s", m->nick, m->userhost);
+            // Don't kick if exempted
+            if (!(use_exempts && (u_match_mask(global_exempts, s1) || u_match_mask(chan->exempts, s1)) &&
+                                  isexempted(chan, s1))) {
+              m->flags |= SENTKICK;
+              dprintf(DP_MODE, "KICK %s %s :%s%s\n", chan->name, m->nick, bankickprefix, reason.c_str());
+            }
+          }
         }
       }
     }