channel: flood warnings for privmsg, not notice (#147)

This commit is contained in:
Ed Kellett 2021-04-17 19:43:59 +01:00 committed by GitHub
parent f8838806ef
commit 92fa29ce37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -32,6 +32,7 @@
#define MAXMODEPARAMSSERV 10
#include <setup.h>
#include "hook.h"
struct Client;
@ -248,7 +249,7 @@ extern void destroy_channel(struct Channel *);
extern int can_send(struct Channel *chptr, struct Client *who,
struct membership *);
extern bool flood_attack_channel(int p_or_n, struct Client *source_p,
extern bool flood_attack_channel(enum message_type msgtype, struct Client *source_p,
struct Channel *chptr, char *chname);
struct matchset;
extern int is_banned(struct Channel *chptr, struct Client *who,

View file

@ -861,7 +861,7 @@ can_send(struct Channel *chptr, struct Client *source_p, struct membership *mspt
* side effects - check for flood attack on target chptr
*/
bool
flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname)
flood_attack_channel(enum message_type msgtype, struct Client *source_p, struct Channel *chptr, char *chname)
{
int delta;
@ -894,7 +894,7 @@ flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr,
/* Add a bit of penalty */
chptr->received_number_of_privmsgs += 2;
}
if(MyClient(source_p) && (p_or_n != 1))
if(MyClient(source_p) && (msgtype != MESSAGE_TYPE_NOTICE))
sendto_one(source_p,
":%s NOTICE %s :*** Message to %s throttled due to flooding",
me.name, source_p->name, chptr->chname);