From 57071409388091f83b03ccdb8f7bd8f613addc7b Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 15 Jul 2000 13:08:39 +0000 Subject: [PATCH] A few checks to check that we really are dealing with IRC servers. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@465 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/irc/irc-completion.c | 3 +++ src/irc/core/irc-commands.c | 3 +++ src/irc/core/irc-server.c | 9 +++++++++ src/irc/core/massjoin.c | 8 ++++++-- src/irc/core/netsplit.c | 4 +++- src/irc/core/server-idle.c | 3 ++- 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/fe-common/irc/irc-completion.c b/src/fe-common/irc/irc-completion.c index 54a3e0db..1784a462 100644 --- a/src/fe-common/irc/irc-completion.c +++ b/src/fe-common/irc/irc-completion.c @@ -105,6 +105,9 @@ static int nick_completion_timeout(void) for (tmp = servers; tmp != NULL; tmp = tmp->next) { IRC_SERVER_REC *rec = tmp->data; + if (!irc_server_check(rec)) + continue; + len = g_slist_length(rec->lastmsgs); if (len > 0 && len >= settings_get_int("completion_keep_privates")) { link = g_slist_last(rec->lastmsgs); diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index f72be600..f95c1f40 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -811,6 +811,9 @@ static void knockout_timeout_server(IRC_SERVER_REC *server) g_return_if_fail(server != NULL); + if (!irc_server_check(server)) + return; + t = server->knockout_lastcheck == 0 ? 0 : time(NULL)-server->knockout_lastcheck; server->knockout_lastcheck = time(NULL); diff --git a/src/irc/core/irc-server.c b/src/irc/core/irc-server.c index c747f757..376b503e 100644 --- a/src/irc/core/irc-server.c +++ b/src/irc/core/irc-server.c @@ -159,6 +159,9 @@ IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn) static void sig_connected(IRC_SERVER_REC *server) { + if (!irc_server_check(server)) + return; + server->eventtable = g_hash_table_new((GHashFunc) g_istr_hash, (GCompareFunc) g_istr_equal); server->eventgrouptable = g_hash_table_new((GHashFunc) g_direct_hash, (GCompareFunc) g_direct_equal); server->cmdtable = g_hash_table_new((GHashFunc) g_istr_hash, (GCompareFunc) g_istr_equal); @@ -196,6 +199,9 @@ static void sig_disconnected(IRC_SERVER_REC *server) { int chans; + if (!irc_server_check(server)) + return; + /* close all channels */ chans = server_remove_channels(server); @@ -235,6 +241,9 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now) char *cmd; int len, ret, add_rawlog; + if (!irc_server_check(server)) + return; + if (server->cmdcount == 0 && server->cmdqueue == NULL) return; diff --git a/src/irc/core/massjoin.c b/src/irc/core/massjoin.c index 649e8c37..553e5ed6 100644 --- a/src/irc/core/massjoin.c +++ b/src/irc/core/massjoin.c @@ -231,8 +231,12 @@ static int sig_massjoin_timeout(void) time_t max; max = time(NULL)-settings_get_int("massjoin_max_wait"); - for (tmp = servers; tmp != NULL; tmp = tmp->next) - server_check_massjoins(tmp->data, max); + for (tmp = servers; tmp != NULL; tmp = tmp->next) { + IRC_SERVER_REC *server = tmp->data; + + if (irc_server_check(server)) + server_check_massjoins(server, max); + } return 1; } diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index d4ea714e..6fec71a5 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -19,6 +19,7 @@ */ #include "module.h" +#include "modules.h" #include "signals.h" #include "commands.h" #include "misc.h" @@ -304,7 +305,8 @@ static int split_check_old(void) for (tmp = servers; tmp != NULL; tmp = tmp->next) { IRC_SERVER_REC *server = tmp->data; - g_hash_table_foreach_remove(server->splits, (GHRFunc) split_server_check, server); + if (irc_server_check(server)) + g_hash_table_foreach_remove(server->splits, (GHRFunc) split_server_check, server); } return 1; diff --git a/src/irc/core/server-idle.c b/src/irc/core/server-idle.c index 273ee231..74e1164a 100644 --- a/src/irc/core/server-idle.c +++ b/src/irc/core/server-idle.c @@ -229,7 +229,8 @@ static int sig_idle_timeout(void) for (tmp = servers; tmp != NULL; tmp = tmp->next) { IRC_SERVER_REC *rec = tmp->data; - if (rec->idles != NULL && rec->cmdcount == 0) { + if (irc_server_check(rec) && + rec->idles != NULL && rec->cmdcount == 0) { /* We're idling and we have idle commands to run! */ server_idle_next(rec); }