diff src/protocols/msn/slplink.c @ 10773:888d4c328be5

[gaim-migrate @ 12382] Patch 1149564 from Felipe Contreras: "[MSN] Cleanups and fixes I know it fixes a multiple conversation close notification but it probably fixes more stuff. I don't know exactly what are the diferences with what Stu did." I munged it a bit, to make it compile and stuff. Please test this, I might have broken it. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 02 Apr 2005 16:38:33 +0000
parents fe919915fceb
children 93663df88ec4
line wrap: on
line diff
--- a/src/protocols/msn/slplink.c	Sat Apr 02 16:07:20 2005 +0000
+++ b/src/protocols/msn/slplink.c	Sat Apr 02 16:38:33 2005 +0000
@@ -67,6 +67,10 @@
 
 	slplink = g_new0(MsnSlpLink, 1);
 
+#ifdef MSN_DEBUG_SLPLINK
+	gaim_debug_info("msn", "slplink_new: slplink(%p)\n", slplink);
+#endif
+
 	slplink->session = session;
 	slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4;
 
@@ -86,6 +90,10 @@
 {
 	MsnSession *session;
 
+#ifdef MSN_DEBUG_SLPLINK
+	gaim_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink);
+#endif
+
 	g_return_if_fail(slplink != NULL);
 
 	if (slplink->swboard != NULL)
@@ -173,11 +181,18 @@
 {
 	slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall);
 
-	/* The slplink has no slpcalls in it, maybe we should destroy it. */
+	/* The slplink has no slpcalls in it. If no one is using it, we might
+	 * destroy the switchboard, but we should be careful not to use the slplink
+	 * again. */
 	if (slplink->slp_calls == NULL)
 	{
 		if (slplink->swboard != NULL)
-			slplink->swboard->flag &= ~MSN_SB_FLAG_FT;
+		{
+			if (msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT))
+				/* I'm not sure this is the best thing to do, but it's better
+				 * than nothing. */
+				slpcall->slplink = NULL;
+		}
 	}
 }
 
@@ -230,7 +245,7 @@
 		if (slplink->swboard == NULL)
 		{
 			slplink->swboard = msn_session_get_swboard(slplink->session,
-													   slplink->remote_user);
+													   slplink->remote_user, MSN_SB_FLAG_FT);
 
 			if (slplink->swboard == NULL)
 				return;