changeset 10434:6be6da69d603

[gaim-migrate @ 11691] A patch from Felipe to ensure switchboards are destroyed when we disconnect. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Mon, 27 Dec 2004 18:53:59 +0000
parents f7f06cb69d5e
children 341d4932f89e
files src/protocols/msn/servconn.c src/protocols/msn/switchboard.c
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/servconn.c	Mon Dec 27 18:46:42 2004 +0000
+++ b/src/protocols/msn/servconn.c	Mon Dec 27 18:53:59 2004 +0000
@@ -191,7 +191,14 @@
 msn_servconn_disconnect(MsnServConn *servconn)
 {
 	g_return_if_fail(servconn != NULL);
-	g_return_if_fail(servconn->connected);
+
+	if (!servconn->connected)
+	{
+		if (servconn->disconnect_cb != NULL)
+			servconn->disconnect_cb(servconn);
+
+		return;
+	}
 
 	if (servconn->inpa > 0)
 	{
--- a/src/protocols/msn/switchboard.c	Mon Dec 27 18:46:42 2004 +0000
+++ b/src/protocols/msn/switchboard.c	Mon Dec 27 18:53:59 2004 +0000
@@ -448,7 +448,7 @@
 	if (swboard->conv == NULL)
 	{
 		/* This is a helper switchboard */
-		msn_switchboard_disconnect(swboard);
+		msn_switchboard_destroy(swboard);
 	}
 	else if (swboard->current_users > 1)
 	{
@@ -494,7 +494,7 @@
 		if (str != NULL)
 			msn_switchboard_report_user(swboard, GAIM_MESSAGE_SYSTEM, str);
 
-		msn_switchboard_disconnect(swboard);
+		msn_switchboard_destroy(swboard);
 	}
 }
 
@@ -920,6 +920,7 @@
 	g_return_val_if_fail(swboard != NULL, FALSE);
 
 	msn_servconn_set_connect_cb(swboard->servconn, connect_cb);
+	msn_servconn_set_disconnect_cb(swboard->servconn, disconnect_cb);
 
 	return msn_servconn_connect(swboard->servconn, host, port);
 }
@@ -929,8 +930,6 @@
 {
 	g_return_if_fail(swboard != NULL);
 
-	msn_servconn_set_disconnect_cb(swboard->servconn, disconnect_cb);
-
 	msn_servconn_disconnect(swboard->servconn);
 }