diff options
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/irc-commands.c | 15 | ||||
-rw-r--r-- | src/irc/core/irc-servers.h | 1 |
2 files changed, 5 insertions, 11 deletions
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 5ecfb482..64b31509 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -52,7 +52,7 @@ typedef struct { IRC_CHANNEL_REC *channel; char *ban; - int timeleft; + time_t unban_time; } KNOCKOUT_REC; static GString *tmpstr; @@ -708,24 +708,19 @@ static void knockout_destroy(IRC_SERVER_REC *server, KNOCKOUT_REC *rec) static void knockout_timeout_server(IRC_SERVER_REC *server) { GSList *tmp, *next; - time_t t; + time_t now; g_return_if_fail(server != NULL); if (!IS_IRC_SERVER(server)) return; - t = server->knockout_lastcheck == 0 ? 0 : - time(NULL)-server->knockout_lastcheck; - server->knockout_lastcheck = time(NULL); - + now = time(NULL); for (tmp = server->knockoutlist; tmp != NULL; tmp = next) { KNOCKOUT_REC *rec = tmp->data; next = tmp->next; - if (rec->timeleft > t) - rec->timeleft -= t; - else { + if (rec->unban_time <= now) { /* timeout, unban. */ ban_remove(rec->channel, rec->ban); knockout_destroy(server, rec); @@ -800,7 +795,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server, else { /* create knockout record */ rec = g_new(KNOCKOUT_REC, 1); - rec->timeleft = timeleft; + rec->unban_time = time(NULL)+timeleft; rec->channel = channel; rec->ban = banmasks; diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 0f4659cd..b0cd84b5 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -87,7 +87,6 @@ struct _IRC_SERVER_REC { /* /knockout ban list */ GSList *knockoutlist; - time_t knockout_lastcheck; GHashTable *splits; /* For keeping track of netsplits */ GSList *split_servers; /* Servers that are currently in split */ |