소스 검색

Added consideration for flood-exempt and fellow bots (#8)

Mark 15 년 전
부모
커밋
5d082da4a0
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      src/mod/irc.mod/irc.c

+ 14 - 0
src/mod/irc.mod/irc.c

@@ -117,6 +117,20 @@ voice_ok(memberlist *m, struct chanset_t *chan)
 static int
 detect_offense(memberlist* m, struct chanset_t *chan, char *msg)
 {
+  if (!chan || !msg
+      || !(chan->capslimit && chan->colorlimit)
+      || chan_sentkick(m)) //sanity check
+    return 0;
+
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0 };
+  struct userrec *u = m->user ? m->user : get_user_by_host(m->userhost);
+  get_user_flagrec(u, &fr, chan->dname, chan);
+
+  if (glob_bot(fr) ||
+      (m && chan->flood_exempt_mode == CHAN_FLAG_OP && chan_hasop(m)) ||
+      (m && chan->flood_exempt_mode == CHAN_FLAG_VOICE && (chan_hasvoice(m) || chan_hasop(m))))
+    return 0;
+
   int tot = (int)strlen(msg);
   int caps_count = 0;
   int color_count = 0;