# HG changeset patch # User Elliott Sales de Andrade # Date 1279408239 0 # Node ID 88a047f92c3989b7c1726115f8f01f3b21e67833 # Parent 3ff6c193efee9a1da2755d7b875165d7848795b4 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. diff -r 3ff6c193efee -r 88a047f92c39 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Sat Jul 17 20:13:29 2010 +0000 +++ b/libpurple/protocols/msn/notification.c Sat Jul 17 23:10:39 2010 +0000 @@ -674,6 +674,8 @@ xmlnode_free(adl_node); xmlnode_free(fqy_node); + msn_session_activate_login_timeout(session); + pc = purple_account_get_connection(session->account); display_name = purple_connection_get_display_name(pc); if (display_name diff -r 3ff6c193efee -r 88a047f92c39 libpurple/protocols/msn/session.c --- 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) { diff -r 3ff6c193efee -r 88a047f92c39 libpurple/protocols/msn/session.h --- a/libpurple/protocols/msn/session.h Sat Jul 17 20:13:29 2010 +0000 +++ b/libpurple/protocols/msn/session.h Sat Jul 17 23:10:39 2010 +0000 @@ -59,6 +59,8 @@ #define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END +#define MSN_LOGIN_FQY_TIMEOUT 30 + #include "group.h" #include "httpconn.h" #include "nexus.h" @@ -83,6 +85,7 @@ gboolean connected; gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ int adl_fqy; /**< A count of ADL/FQY so status is only changed once. */ + guint login_timeout; /**< Timeout to force status change if ADL/FQY fail. */ gboolean destroying; /**< A flag that states if the session is being destroyed. */ gboolean http_method; @@ -213,7 +216,16 @@ const char *info); /** - * Sets the current step in the login proccess. + * Starts a timeout to initiate finishing login. Sometimes the server ignores + * our FQY requests, so this forces ourselves online eventually. + * + * @param session The MSN session. + */ +void +msn_session_activate_login_timeout(MsnSession *session); + +/** + * Sets the current step in the login process. * * @param session The MSN session. * @param step The current step.