1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Don't add the same mask to the knockout list multiple times.

This fixes bug #510. Note that #510 only happened if multiple
bans were sent before the MODE came back and multiple unbans
were sent before the MODE came back.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4544 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Jilles Tjoelker 2007-06-06 17:57:28 +00:00 committed by jilles
parent 0bfffb33ce
commit ff63982d4f

View File

@ -802,6 +802,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
char **nicklist, *spacenicks, *banmasks; char **nicklist, *spacenicks, *banmasks;
void *free_arg; void *free_arg;
int timeleft; int timeleft;
GSList *ptr;
CMD_IRC_SERVER(server); CMD_IRC_SERVER(server);
@ -856,14 +857,21 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
if (*banmasks == '\0') if (*banmasks == '\0')
g_free(banmasks); g_free(banmasks);
else { else {
/* create knockout record */ /* check if we already have this knockout */
for (ptr = server->knockoutlist; ptr != NULL; ptr = ptr->next) {
rec = ptr->data;
if (channel == rec->channel &&
!strcmp(rec->ban, banmasks))
break;
}
if (ptr == NULL) {
rec = g_new(KNOCKOUT_REC, 1); rec = g_new(KNOCKOUT_REC, 1);
rec->unban_time = time(NULL)+timeleft/1000;
rec->channel = channel; rec->channel = channel;
rec->ban = banmasks; rec->ban = banmasks;
server->knockoutlist = g_slist_append(server->knockoutlist, rec); server->knockoutlist = g_slist_append(server->knockoutlist, rec);
} }
rec->unban_time = time(NULL)+timeleft/1000;
}
cmd_params_free(free_arg); cmd_params_free(free_arg);
} }