summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-15 00:21:24 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-15 00:21:24 +0000
commitc17439820d2c5a66c6ea8c17ba6be61a6da82582 (patch)
tree035c6a1eba8b8ac13e6312eaf85394a65070fecd /src
parent25d0d40d5ac479fa80d01119921a05ca93211a59 (diff)
downloadirssi-c17439820d2c5a66c6ea8c17ba6be61a6da82582.zip
Don't crash when connecting to server with unknown chat protocol (eg.
specified in config file but module not loaded yet). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2013 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/core/chat-protocols.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/chat-protocols.c b/src/core/chat-protocols.c
index ab7c09d4..2989598c 100644
--- a/src/core/chat-protocols.c
+++ b/src/core/chat-protocols.c
@@ -156,7 +156,13 @@ void chat_protocol_unregister(const char *name)
g_return_if_fail(name != NULL);
rec = chat_protocol_find(name);
- if (rec != NULL) chat_protocol_destroy(rec);
+ if (rec != NULL) {
+ chat_protocol_destroy(rec);
+
+ /* there might still be references to this chat protocol -
+ recreate it as a dummy protocol */
+ chat_protocol_get_unknown(name);
+ }
}
/* Default chat protocol to use */
@@ -190,6 +196,10 @@ static SERVER_CONNECT_REC *create_server_connect(void)
return g_new0(SERVER_CONNECT_REC, 1);
}
+static void destroy_server_connect(SERVER_CONNECT_REC *conn)
+{
+}
+
/* Return "unknown chat protocol" record. Used when protocol name is
specified but it isn't registered yet. */
CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name)
@@ -209,6 +219,7 @@ CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name)
rec->create_server_setup = create_server_setup;
rec->create_channel_setup = create_channel_setup;
rec->create_server_connect = create_server_connect;
+ rec->destroy_server_connect = destroy_server_connect;
newrec = chat_protocol_register(rec);
g_free(rec);