Просмотр исходного кода

* Fixed msgs being logged when the msg has triggered an ignore for flooding. (#23)

svn: 2029
Bryan Drewery 21 лет назад
Родитель
Сommit
4a5da22414
2 измененных файлов с 9 добавлено и 6 удалено
  1. 1 0
      doc/UPDATES
  2. 8 6
      src/mod/server.mod/servmsg.c

+ 1 - 0
doc/UPDATES

@@ -91,6 +91,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed, or
 * Rewrote how logs are shared over botnet, now uses much less bw and resources. (#31)
 * Rewrote how logs are shared over botnet, now uses much less bw and resources. (#31)
   -[will break logging during update]
   -[will break logging during update]
 * Added some missing logging for msg_pass (#34)
 * Added some missing logging for msg_pass (#34)
+* Fixed msgs being logged when the msg has triggered an ignore for flooding. (#23)
 
 
 1.2.2
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 8 - 6
src/mod/server.mod/servmsg.c

@@ -364,6 +364,7 @@ static bool detect_flood(char *floodnick, char *floodhost, char *from, int which
     simple_sprintf(h, "*!*@%s", p);
     simple_sprintf(h, "*!*@%s", p);
     putlog(LOG_MISC, "*", IRC_FLOODIGNORE1, p);
     putlog(LOG_MISC, "*", IRC_FLOODIGNORE1, p);
     addignore(h, conf.bot->nick, (which == FLOOD_CTCP) ? "CTCP flood" : "MSG/NOTICE flood", now + (60 * ignore_time));
     addignore(h, conf.bot->nick, (which == FLOOD_CTCP) ? "CTCP flood" : "MSG/NOTICE flood", now + (60 * ignore_time));
+    return 1;
   }
   }
   return 0;
   return 0;
 }
 }
@@ -414,6 +415,7 @@ static int gotmsg(char *from, char *msg)
 	p = uhost;
 	p = uhost;
       simple_sprintf(ctcpbuf, "*!*@%s", p);
       simple_sprintf(ctcpbuf, "*!*@%s", p);
       addignore(ctcpbuf, conf.bot->nick, "ctcp avalanche", now + (60 * ignore_time));
       addignore(ctcpbuf, conf.bot->nick, "ctcp avalanche", now + (60 * ignore_time));
+      ignoring++;
     }
     }
   }
   }
 
 
@@ -430,7 +432,7 @@ static int gotmsg(char *from, char *msg)
       ctcp = strcpy(ctcpbuf, p1);
       ctcp = strcpy(ctcpbuf, p1);
       strcpy(p1 - 1, p + 1);
       strcpy(p1 - 1, p + 1);
       if (!ignoring)
       if (!ignoring)
-        detect_flood(nick, uhost, from, strncmp(ctcp, "ACTION ", 7) ? FLOOD_CTCP : FLOOD_PRIVMSG);
+        ignoring = detect_flood(nick, uhost, from, strncmp(ctcp, "ACTION ", 7) ? FLOOD_CTCP : FLOOD_PRIVMSG);
       /* Respond to the first answer_ctcp */
       /* Respond to the first answer_ctcp */
       p = strchr(msg, 1);
       p = strchr(msg, 1);
       if (ctcp_count < answer_ctcp) {
       if (ctcp_count < answer_ctcp) {
@@ -508,8 +510,8 @@ static int gotmsg(char *from, char *msg)
   if (msg[0]) {
   if (msg[0]) {
     if ((to[0] == '$') || (strchr(to, '.') != NULL)) {
     if ((to[0] == '$') || (strchr(to, '.') != NULL)) {
       /* Msg from oper */
       /* Msg from oper */
+      ignoring = detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
       if (!ignoring) {
       if (!ignoring) {
-	detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
 	/* Do not interpret as command */
 	/* Do not interpret as command */
 	putlog(LOG_MSGS | LOG_SERV, "*", "[%s!%s to %s] %s",nick, uhost, to, msg);
 	putlog(LOG_MSGS | LOG_SERV, "*", "[%s!%s to %s] %s",nick, uhost, to, msg);
       }
       }
@@ -518,7 +520,7 @@ static int gotmsg(char *from, char *msg)
       Auth *auth = Auth::Find(uhost);
       Auth *auth = Auth::Find(uhost);
 
 
       if (!auth)
       if (!auth)
-        detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
+        ignoring = detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
       my_code = newsplit(&msg);
       my_code = newsplit(&msg);
       rmspace(msg);
       rmspace(msg);
       /* is it a cmd? */
       /* is it a cmd? */
@@ -598,7 +600,7 @@ static int gotnotice(char *from, char *msg)
       ctcp = strcpy(ctcpbuf, p1);
       ctcp = strcpy(ctcpbuf, p1);
       strcpy(p1 - 1, p + 1);
       strcpy(p1 - 1, p + 1);
       if (!ignoring)
       if (!ignoring)
-	detect_flood(nick, uhost, from, FLOOD_CTCP);
+	ignoring = detect_flood(nick, uhost, from, FLOOD_CTCP);
       p = strchr(ctcpmsg, 1);
       p = strchr(ctcpmsg, 1);
       if (ctcp[0] != ' ') {
       if (ctcp[0] != ' ') {
 	char *code = newsplit(&ctcp);
 	char *code = newsplit(&ctcp);
@@ -622,7 +624,7 @@ static int gotnotice(char *from, char *msg)
   free(ptr);
   free(ptr);
   if (msg[0]) {
   if (msg[0]) {
     if (((to[0] == '$') || strchr(to, '.')) && !ignoring) {
     if (((to[0] == '$') || strchr(to, '.')) && !ignoring) {
-      detect_flood(nick, uhost, from, FLOOD_NOTICE);
+      ignoring = detect_flood(nick, uhost, from, FLOOD_NOTICE);
       putlog(LOG_MSGS | LOG_SERV, "*", "-%s (%s) to %s- %s", nick, uhost, to, msg);
       putlog(LOG_MSGS | LOG_SERV, "*", "-%s (%s) to %s- %s", nick, uhost, to, msg);
     } else {
     } else {
       /* Server notice? */
       /* Server notice? */
@@ -635,7 +637,7 @@ static int gotnotice(char *from, char *msg)
 	if (strncmp(msg, "Highest connection count:", 25))
 	if (strncmp(msg, "Highest connection count:", 25))
 	  putlog(LOG_SERV, "*", "-NOTICE- %s", msg);
 	  putlog(LOG_SERV, "*", "-NOTICE- %s", msg);
       } else {
       } else {
-        detect_flood(nick, uhost, from, FLOOD_NOTICE);
+        ignoring = detect_flood(nick, uhost, from, FLOOD_NOTICE);
         u = get_user_by_host(from);
         u = get_user_by_host(from);
         if (!ignoring)
         if (!ignoring)
   	      putlog(LOG_MSGS, "*", "-%s (%s)- %s", nick, uhost, msg);
   	      putlog(LOG_MSGS, "*", "-%s (%s)- %s", nick, uhost, msg);