Jelajahi Sumber

Remove useless victim check

Bryan Drewery 14 tahun lalu
induk
melakukan
5a5ccbb54a
3 mengubah file dengan 10 tambahan dan 20 penghapusan
  1. 0 1
      src/chan.h
  2. 9 18
      src/mod/irc.mod/chan.c
  3. 1 1
      src/mod/irc.mod/irc.h

+ 0 - 1
src/chan.h

@@ -222,7 +222,6 @@ struct chanset_t {
   char topic[121];
   char added_by[HANDLEN + 1];	/* who added the channel? */
   char floodwho[FLOOD_CHAN_MAX][128];
-  char deopd[NICKLEN];		/* last person deop'd (must change	*/
   char dname[81];               /* what the users know the channel as like !eggdev */
   char name[81];                /* what the servers know the channel as, like !ABCDEeggdev */
 };

+ 9 - 18
src/mod/irc.mod/chan.c

@@ -542,7 +542,7 @@ static void do_mask(struct chanset_t *chan, masklist *m, char *mask, char Mode)
 /* This is a clone of detect_flood, but works for channel specificity now
  * and handles kick & deop as well.
  */
-static bool detect_chan_flood(memberlist* m, const char *from, struct chanset_t *chan, int which, const char *victim, const char *msg)
+static bool detect_chan_flood(memberlist* m, const char *from, struct chanset_t *chan, int which, const char *msg)
 {
   /* Do not punish non-existant channel members and IRC services like
    * ChanServ
@@ -640,21 +640,12 @@ static bool detect_chan_flood(memberlist* m, const char *from, struct chanset_t
     chan->floodnum[which] = 1;
     return 0;
   }
-  /* Deop'n the same person, sillyness ;) - so just ignore it */
-  if (which == FLOOD_DEOP) {
-    if (!rfc_casecmp(chan->deopd, victim))
-      return 0;
-    else
-      strlcpy(chan->deopd, victim, sizeof(chan->deopd));
-  }
   chan->floodnum[which]++;
   if (chan->floodnum[which] >= thr) {	/* FLOOD */
     /* Reset counters */
     chan->floodnum[which] = 0;
     chan->floodtime[which] = 0;
     chan->floodwho[which][0] = 0;
-    if (which == FLOOD_DEOP)
-      chan->deopd[0] = 0;
     switch (which) {
     case FLOOD_PRIVMSG:
     case FLOOD_NOTICE:
@@ -2676,7 +2667,7 @@ static int gotjoin(char *from, char *chname)
  	    reset_chan_info(chan);
 	} else {
           irc_log(chan, "Join: %s (%s)", nick, uhost);
-          detect_chan_flood(m, from, chan, FLOOD_JOIN, NULL);
+          detect_chan_flood(m, from, chan, FLOOD_JOIN);
 	  set_handle_laston(chan->dname, m->user, now);
 	}
       }
@@ -2829,7 +2820,7 @@ static int gotpart(char *from, char *msg)
     set_handle_laston(chan->dname, u, now);
 
     if (m) {
-      detect_chan_flood(m, from, chan, FLOOD_PART, NULL);
+      detect_chan_flood(m, from, chan, FLOOD_PART);
       killmember(chan, nick);
     }
     if (msg[0])
@@ -2880,7 +2871,7 @@ static int gotkick(char *from, char *origmsg)
 
     m = ismember(chan, whodid);
     if (m) {
-      detect_chan_flood(m, from, chan, FLOOD_KICK, nick);
+      detect_chan_flood(m, from, chan, FLOOD_KICK);
 
       m->last = now;
       member_getuser(m);
@@ -2973,7 +2964,7 @@ static int gotnick(char *from, char *msg)
 
       memberlist_reposition(chan, m);
 
-      detect_chan_flood(m, from, chan, FLOOD_NICK, NULL);
+      detect_chan_flood(m, from, chan, FLOOD_NICK);
 
       /* don't fill the serverqueue with modes or kicks in a nickflood */
       if (chan_sentkick(m) || chan_sentdeop(m) || chan_sentop(m) ||
@@ -3194,7 +3185,7 @@ static int gotmsg(char *from, char *msg)
       strlcpy(ctcp, p1, sizeof(buf2));
       strcpy(p1 - 1, p + 1);
       if (m) {
-        detect_chan_flood(m, from, chan, strncmp(ctcp, "ACTION ", 7) ? FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
+        detect_chan_flood(m, from, chan, strncmp(ctcp, "ACTION ", 7) ? FLOOD_CTCP : FLOOD_PRIVMSG);
       }
 
       /* Respond to the first answer_ctcp */
@@ -3245,7 +3236,7 @@ static int gotmsg(char *from, char *msg)
 #endif
 
     if (m) {
-      detect_chan_flood(m, from, chan, FLOOD_PRIVMSG, NULL);
+      detect_chan_flood(m, from, chan, FLOOD_PRIVMSG);
     }
     
     if (auth_chan) {
@@ -3341,7 +3332,7 @@ static int gotnotice(char *from, char *msg)
       strcpy(p1 - 1, p + 1);
       p = strchr(msg, 1);
       if (m) {
-        detect_chan_flood(m, from, chan, strncmp(ctcp, "ACTION ", 7) ? FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
+        detect_chan_flood(m, from, chan, strncmp(ctcp, "ACTION ", 7) ? FLOOD_CTCP : FLOOD_PRIVMSG);
       }
 
       if (ctcp[0] != ' ') {
@@ -3360,7 +3351,7 @@ static int gotnotice(char *from, char *msg)
   }
   if (msg[0]) {
     if (m) {
-      detect_chan_flood(m, from, chan, FLOOD_NOTICE, NULL);
+      detect_chan_flood(m, from, chan, FLOOD_NOTICE);
     }
 
     update_idle(chan->dname, nick);

+ 1 - 1
src/mod/irc.mod/irc.h

@@ -82,7 +82,7 @@ static void do_protect(struct chanset_t* chan, const char* reason);
 static bool do_op(char *, struct chanset_t *, bool, bool);
 static void request_op(struct chanset_t *);
 static void request_in(struct chanset_t *);
-static bool detect_chan_flood(memberlist *m, const char* from, struct chanset_t *chan, int which, const char *victim, const char *msg = NULL);
+static bool detect_chan_flood(memberlist *m, const char* from, struct chanset_t *chan, int which, const char *msg = NULL);
 static bool new_mask(masklist *, char *, char *);
 static void do_closed_kick(struct chanset_t *, memberlist *);
 static char *quickban(struct chanset_t *, char *);