From 6b1fcf9c75535453ae4de1a96a4f2b199d748043 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sun, 11 Jun 2017 00:08:07 +1000 Subject: [PATCH] Add sent_nick flag to NickList struct, bump MODULE_VERSION This flag is for tracking if we've sent a KICK for a nick. It means we can avoid sending duplicate KICKs (eg for floods, channel protection etc). MODULE_VERSION is bumped because NickList is a struct exported to modules. --- Changelog | 2 ++ include/module.h | 4 ++-- include/struct.h | 3 +++ source/names.c | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 67264ce..f4e8692 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Add sent_nick flag to NickList struct, bump MODULE_VERSION. (caf) + * Write correct length to terminal for unflash sequences. (caf) * Update source file dependencies in Makefile.in. (caf) diff --git a/include/module.h b/include/module.h index e1a16ed..12c7217 100644 --- a/include/module.h +++ b/include/module.h @@ -8,9 +8,9 @@ /* * if we change the table below, we change this module number to the - * current date. + * current date (YYYYMMDDxx where xx is a serial number). */ -#define MODULE_VERSION 011000 +#define MODULE_VERSION 2017071001UL #include "struct.h" diff --git a/include/struct.h b/include/struct.h index b8f94b3..2ca790e 100644 --- a/include/struct.h +++ b/include/struct.h @@ -482,12 +482,15 @@ typedef struct nick_stru unsigned stat_pub; /* Total publics sent by user */ unsigned stat_topics; /* Total topics set by user */ + /* Tracking state changes for this client sent by us, so + * we don't send them unnecessarily. */ unsigned sent_reop; time_t sent_reop_time; unsigned sent_voice; time_t sent_voice_time; unsigned sent_deop; time_t sent_deop_time; + unsigned sent_kick; unsigned need_userhost; /* on join we send a userhost for this nick */ unsigned check_clone; /* added for builtin clone detect */ diff --git a/source/names.c b/source/names.c index 7477eb9..de18484 100644 --- a/source/names.c +++ b/source/names.c @@ -372,7 +372,7 @@ ChannelList *BX_add_to_channel(char *channel, char *nick, int server, int oper, new->bancount = new->nickcount = new->dopcount = new->kickcount = new->floodcount = new->ip_count = - new->sent_voice = 0; + new->sent_voice = new->sent_kick = 0; new->flags = 0; new->serverhops = server_hops; new->next = NULL; @@ -828,7 +828,7 @@ int in_join = 0; else if (!add && add != channel->have_op && !in_join) { for(tmp = next_nicklist(channel, NULL); tmp; tmp = next_nicklist(channel, tmp)) - tmp->sent_reop = tmp->sent_deop = tmp->sent_voice = 0; + tmp->sent_reop = tmp->sent_deop = tmp->sent_voice = tmp->sent_kick = 0; } return have_op; }