diff libpurple/protocols/msn/session.c @ 30267:88a047f92c39

Add a timeout which forces the login process to complete. This won't fix the underlying problem of a failed FQY, but at least it will complete the connection and show people online. Refs #10023. Refs #12210.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 17 Jul 2010 23:10:39 +0000
parents 62ca462d0abc
children ea96292336f0 47b6eda87723
line wrap: on
line diff
--- a/libpurple/protocols/msn/session.c	Sat Jul 17 20:13:29 2010 +0000
+++ b/libpurple/protocols/msn/session.c	Sat Jul 17 23:10:39 2010 +0000
@@ -131,6 +131,11 @@
 	if (!session->connected)
 		return;
 
+	if (session->login_timeout) {
+		purple_timeout_remove(session->login_timeout);
+		session->login_timeout = 0;
+	}
+
 	session->connected = FALSE;
 
 	while (session->switches != NULL)
@@ -258,6 +263,28 @@
 	return swboard;
 }
 
+static gboolean
+msn_login_timeout_cb(gpointer data)
+{
+	MsnSession *session = data;
+	/* This forces the login process to finish, even though we haven't heard
+	   a response for our FQY requests yet. We'll at least end up online to the
+	   people we've already added. The rest will follow later. */
+	msn_session_finish_login(session);
+	session->login_timeout = 0;
+	return FALSE;
+}
+
+void
+msn_session_activate_login_timeout(MsnSession *session)
+{
+	if (!session->logged_in) {
+		session->login_timeout =
+			purple_timeout_add_seconds(MSN_LOGIN_FQY_TIMEOUT,
+			                           msn_login_timeout_cb, session);
+	}
+}
+
 static void
 msn_session_sync_users(MsnSession *session)
 {