diff src/protocols/msn/slpcall.c @ 10225:ecf3ce2e2ab1

[gaim-migrate @ 11357] This is mostly a patch from Felipe Contreras that eliminates MSN switchboard errors and fixes MSN buddy icon syncronization, with some tweaks by me. Thank Felipe if it works, blame me if something broke. I also fixed a couple of text markup escaping things, fixed a glib warning that was bugging me, fix a rare SILC crash, and make gtkstatusselector.c compile (but do nothing) with gtk < 2.4 committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 21 Nov 2004 17:48:09 +0000
parents 3a701f15e45d
children a7b2fd5efcf2
line wrap: on
line diff
--- a/src/protocols/msn/slpcall.c	Sun Nov 21 06:16:23 2004 +0000
+++ b/src/protocols/msn/slpcall.c	Sun Nov 21 17:48:09 2004 +0000
@@ -62,6 +62,8 @@
 	slplink->slp_calls =
 		g_list_append(slplink->slp_calls, slpcall);
 
+	slpcall->timer = gaim_timeout_add(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall);
+
 	return slpcall;
 }
 
@@ -93,6 +95,9 @@
 
 	g_return_if_fail(slpcall != NULL);
 
+	if (slpcall->timer)
+		gaim_timeout_remove(slpcall->timer);
+
 	if (slpcall->id != NULL)
 		g_free(slpcall->id);
 
@@ -181,6 +186,16 @@
 	msn_slp_call_destroy(slpcall);
 }
 
+gboolean
+msn_slp_call_timeout(gpointer data)
+{
+	gaim_debug_info("msn", "slpcall timeout\n");
+
+	msn_slp_call_destroy(data);
+
+	return FALSE;
+}
+
 MsnSlpCall *
 msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
 {
@@ -201,7 +216,20 @@
 		slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id);
 
 		if (slpcall != NULL)
+		{
+			if (slpcall->timer)
+				gaim_timeout_remove(slpcall->timer);
+
 			slpcall->cb(slpcall, body, body_len);
+
+			/* TODO: Shall we send a BYE? I don't think so*/
+#if 0
+			send_bye(slpcall, "application/x-msnmsgr-sessionclosebody");
+			msn_slplink_unleash(slpcall->slplink);
+#endif
+
+			slpcall->wasted = TRUE;
+		}
 	}
 #if 0
 	else if (slpmsg->flags == 0x100)
@@ -213,5 +241,14 @@
 	}
 #endif
 
+	if (slpcall != NULL)
+	{
+		if (slpcall->timer)
+			gaim_timeout_remove(slpcall->timer);
+
+		slpcall->timer = gaim_timeout_add(MSN_SLPCALL_TIMEOUT,
+										  msn_slp_call_timeout, slpcall);
+	}
+
 	return slpcall;
 }