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

Bugfixes for non-irc server handling.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@550 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-30 17:19:16 +00:00 committed by cras
parent 05cfbaf9d5
commit 87a8f71344
9 changed files with 27 additions and 15 deletions

View File

@ -229,6 +229,8 @@ void server_disconnect(SERVER_REC *server)
if (server->handle != NULL) if (server->handle != NULL)
net_sendbuffer_destroy(server->handle, TRUE); net_sendbuffer_destroy(server->handle, TRUE);
if (server->readtag > 0)
g_source_remove(server->readtag);
MODULE_DATA_DEINIT(server); MODULE_DATA_DEINIT(server);
rawlog_destroy(server->rawlog); rawlog_destroy(server->rawlog);

View File

@ -574,6 +574,9 @@ static void completion_deinit_server(IRC_SERVER_REC *server)
{ {
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server))
return;
g_slist_foreach(server->lastmsgs, (GFunc) g_free, NULL); g_slist_foreach(server->lastmsgs, (GFunc) g_free, NULL);
g_slist_free(server->lastmsgs); g_slist_free(server->lastmsgs);
} }

View File

@ -59,6 +59,9 @@ static void event_target_unavailable(const char *data, IRC_SERVER_REC *server)
static void sig_disconnected(IRC_SERVER_REC *server) static void sig_disconnected(IRC_SERVER_REC *server)
{ {
if (!irc_server_check(server))
return;
g_slist_foreach(server->rejoin_channels, (GFunc) g_free, NULL); g_slist_foreach(server->rejoin_channels, (GFunc) g_free, NULL);
g_slist_free(server->rejoin_channels); g_slist_free(server->rejoin_channels);
} }

View File

@ -73,7 +73,8 @@ static void sig_connected(IRC_SERVER_REC *server)
SERVER_QUERY_REC *rec; SERVER_QUERY_REC *rec;
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server)) return; if (!irc_server_check(server))
return;
rec = g_new0(SERVER_QUERY_REC, 1); rec = g_new0(SERVER_QUERY_REC, 1);
server->chanqueries = rec; server->chanqueries = rec;
@ -85,7 +86,8 @@ static void sig_disconnected(IRC_SERVER_REC *server)
int n; int n;
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server)) return; if (!irc_server_check(server))
return;
rec = server->chanqueries; rec = server->chanqueries;
g_return_if_fail(rec != NULL); g_return_if_fail(rec != NULL);

View File

@ -182,10 +182,13 @@ static void event_notice(const char *data, IRC_SERVER_REC *server, const char *n
g_free(params); g_free(params);
} }
static void ctcp_deinit_server(IRC_SERVER_REC *server) static void sig_disconnected(IRC_SERVER_REC *server)
{ {
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server))
return;
g_slist_free(server->ctcpqueue); g_slist_free(server->ctcpqueue);
} }
@ -194,7 +197,7 @@ void ctcp_init(void)
settings_add_str("misc", "ctcp_version_reply", PACKAGE" v$J - running on $sysname"); settings_add_str("misc", "ctcp_version_reply", PACKAGE" v$J - running on $sysname");
settings_add_int("flood", "max_ctcp_queue", 5); settings_add_int("flood", "max_ctcp_queue", 5);
signal_add("server disconnected", (SIGNAL_FUNC) ctcp_deinit_server); signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected);
signal_add_first("event privmsg", (SIGNAL_FUNC) event_privmsg); signal_add_first("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_add_first("event notice", (SIGNAL_FUNC) event_notice); signal_add_first("event notice", (SIGNAL_FUNC) event_notice);
signal_add("ctcp msg", (SIGNAL_FUNC) ctcp_msg); signal_add("ctcp msg", (SIGNAL_FUNC) ctcp_msg);
@ -206,7 +209,7 @@ void ctcp_init(void)
void ctcp_deinit(void) void ctcp_deinit(void)
{ {
signal_remove("server disconnected", (SIGNAL_FUNC) ctcp_deinit_server); signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg); signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_remove("event notice", (SIGNAL_FUNC) event_notice); signal_remove("event notice", (SIGNAL_FUNC) event_notice);
signal_remove("ctcp msg", (SIGNAL_FUNC) ctcp_msg); signal_remove("ctcp msg", (SIGNAL_FUNC) ctcp_msg);

View File

@ -913,6 +913,9 @@ static void sig_server_disconnected(IRC_SERVER_REC *server)
{ {
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server))
return;
while (server->knockoutlist != NULL) while (server->knockoutlist != NULL)
knockout_destroy(server, server->knockoutlist->data); knockout_destroy(server, server->knockoutlist->data);
} }

View File

@ -350,14 +350,6 @@ static void irc_init_server(IRC_SERVER_REC *server)
(GInputFunction) irc_parse_incoming, server); (GInputFunction) irc_parse_incoming, server);
} }
static void irc_deinit_server(IRC_SERVER_REC *server)
{
g_return_if_fail(server != NULL);
if (server->readtag > 0)
g_source_remove(server->readtag);
}
#define isoptchan(a) \ #define isoptchan(a) \
(ischannel((a)[0]) || ((a)[0] == '*' && ((a)[1] == '\0' || (a)[1] == ' '))) (ischannel((a)[0]) || ((a)[0] == '*' && ((a)[1] == '\0' || (a)[1] == ' ')))
@ -400,7 +392,6 @@ void irc_irc_init(void)
signal_add("server event", (SIGNAL_FUNC) irc_server_event); signal_add("server event", (SIGNAL_FUNC) irc_server_event);
signal_add("server connected", (SIGNAL_FUNC) irc_init_server); signal_add("server connected", (SIGNAL_FUNC) irc_init_server);
signal_add_first("server disconnected", (SIGNAL_FUNC) irc_deinit_server);
signal_add("server incoming", (SIGNAL_FUNC) irc_parse_incoming_line); signal_add("server incoming", (SIGNAL_FUNC) irc_parse_incoming_line);
current_server_event = NULL; current_server_event = NULL;
@ -414,7 +405,6 @@ void irc_irc_deinit(void)
{ {
signal_remove("server event", (SIGNAL_FUNC) irc_server_event); signal_remove("server event", (SIGNAL_FUNC) irc_server_event);
signal_remove("server connected", (SIGNAL_FUNC) irc_init_server); signal_remove("server connected", (SIGNAL_FUNC) irc_init_server);
signal_remove("server disconnected", (SIGNAL_FUNC) irc_deinit_server);
signal_remove("server incoming", (SIGNAL_FUNC) irc_parse_incoming_line); signal_remove("server incoming", (SIGNAL_FUNC) irc_parse_incoming_line);
module_uniq_destroy("IRC"); module_uniq_destroy("IRC");

View File

@ -284,6 +284,9 @@ static void sig_disconnected(IRC_SERVER_REC *server)
{ {
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server))
return;
g_hash_table_foreach(server->splits, (GHFunc) netsplit_destroy_hash, server); g_hash_table_foreach(server->splits, (GHFunc) netsplit_destroy_hash, server);
g_hash_table_destroy(server->splits); g_hash_table_destroy(server->splits);
} }

View File

@ -217,6 +217,9 @@ static void sig_disconnected(IRC_SERVER_REC *server)
{ {
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (!irc_server_check(server))
return;
while (server->idles != NULL) while (server->idles != NULL)
server_idle_destroy(server, server->idles->data); server_idle_destroy(server, server->idles->data);
} }