From b2705089ce8a1860dc47acdccda9d7e68102aa40 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 5 Oct 2019 12:58:41 +0200 Subject: [PATCH] Clean up floodprot_*nickchange now that the prototypes are the same for local and remote. Suggested by westor. --- src/modules/chanmodes/floodprot.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index 975c61993..06a18a9bb 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -120,8 +120,7 @@ int cmodef_channel_destroy(Channel *channel, int *should_destroy); int floodprot_can_send_to_channel(Client *client, Channel *channel, Membership *lp, char **msg, char **errmsg, int notice); int floodprot_post_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); int floodprot_knock(Client *client, Channel *channel, MessageTag *mtags, char *comment); -int floodprot_local_nickchange(Client *client, char *oldnick); -int floodprot_remote_nickchange(Client *client, char *oldnick); +int floodprot_nickchange(Client *client, char *oldnick); int floodprot_chanmode_del(Channel *channel, int m); void memberflood_free(ModData *md); int floodprot_stats(Client *client, char *flag); @@ -176,8 +175,8 @@ MOD_INIT() HookAdd(modinfo->handle, HOOKTYPE_CAN_SEND_TO_CHANNEL, 0, floodprot_can_send_to_channel); HookAdd(modinfo->handle, HOOKTYPE_CHANMSG, 0, floodprot_post_chanmsg); HookAdd(modinfo->handle, HOOKTYPE_KNOCK, 0, floodprot_knock); - HookAdd(modinfo->handle, HOOKTYPE_LOCAL_NICKCHANGE, 0, floodprot_local_nickchange); - HookAdd(modinfo->handle, HOOKTYPE_REMOTE_NICKCHANGE, 0, floodprot_remote_nickchange); + HookAdd(modinfo->handle, HOOKTYPE_LOCAL_NICKCHANGE, 0, floodprot_nickchange); + HookAdd(modinfo->handle, HOOKTYPE_REMOTE_NICKCHANGE, 0, floodprot_nickchange); HookAdd(modinfo->handle, HOOKTYPE_MODECHAR_DEL, 0, floodprot_chanmode_del); HookAdd(modinfo->handle, HOOKTYPE_LOCAL_JOIN, 0, floodprot_join); HookAdd(modinfo->handle, HOOKTYPE_REMOTE_JOIN, 0, floodprot_join); @@ -1096,9 +1095,12 @@ int floodprot_knock(Client *client, Channel *channel, MessageTag *mtags, char *c return 0; } -static int gotnickchange(Client *client) +int floodprot_nickchange(Client *client, char *oldnick) { -Membership *mp; + Membership *mp; + + if (IsULine(client)) + return 0; for (mp = client->user->channel; mp; mp = mp->next) { @@ -1113,20 +1115,6 @@ Membership *mp; return 0; } -int floodprot_local_nickchange(Client *client, char *oldnick) -{ - if (IsULine(client)) - return 0; - return gotnickchange(client); -} - -int floodprot_remote_nickchange(Client *client, char *oldnick) -{ - if (IsULine(client)) - return 0; - return gotnickchange(client); -} - int floodprot_chanmode_del(Channel *channel, int modechar) { ChannelFloodProtection *chp;