mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04: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:
parent
0bfffb33ce
commit
ff63982d4f
@ -802,6 +802,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
|
||||
char **nicklist, *spacenicks, *banmasks;
|
||||
void *free_arg;
|
||||
int timeleft;
|
||||
GSList *ptr;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
@ -856,13 +857,20 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
|
||||
if (*banmasks == '\0')
|
||||
g_free(banmasks);
|
||||
else {
|
||||
/* create knockout record */
|
||||
rec = g_new(KNOCKOUT_REC, 1);
|
||||
/* 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->channel = channel;
|
||||
rec->ban = banmasks;
|
||||
server->knockoutlist = g_slist_append(server->knockoutlist, rec);
|
||||
}
|
||||
rec->unban_time = time(NULL)+timeleft/1000;
|
||||
rec->channel = channel;
|
||||
rec->ban = banmasks;
|
||||
|
||||
server->knockoutlist = g_slist_append(server->knockoutlist, rec);
|
||||
}
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
|
Loading…
Reference in New Issue
Block a user