# HG changeset patch # User Elliott Sales de Andrade # Date 1259722019 0 # Node ID ed838ad00173247ea1aff0fccce05771bfa06ab8 # Parent e30865b6285995897ca081e8c6cccaeed737d494 Fix MSN protocol version detection to use the best version returned by the server. diff -r e30865b62859 -r ed838ad00173 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Tue Dec 01 22:13:30 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Dec 02 02:46:59 2009 +0000 @@ -236,20 +236,22 @@ MsnSession *session; PurpleAccount *account; gboolean protocol_supported = FALSE; - char proto_str[8]; + int proto_ver; size_t i; session = cmdproc->session; account = session->account; - g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); - + session->protocol_ver = 0; for (i = 1; i < cmd->param_count; i++) { - if (!strcmp(cmd->params[i], proto_str)) - { - protocol_supported = TRUE; - break; + if (sscanf(cmd->params[i], "MSNP%d", &proto_ver) == 1) { + if (proto_ver >= WLM_MIN_PROTOCOL + && proto_ver <= WLM_MAX_PROTOCOL + && proto_ver > session->protocol_ver) { + protocol_supported = TRUE; + session->protocol_ver = proto_ver; + } } } @@ -260,6 +262,8 @@ return; } + purple_debug_info("msn", "Negotiated protocol version %d with the server.\n", session->protocol_ver); + /* * Windows Live Messenger 8.5 * Notice :CVR String discriminate! diff -r e30865b62859 -r ed838ad00173 libpurple/protocols/msn/session.c --- a/libpurple/protocols/msn/session.c Tue Dec 01 22:13:30 2009 +0000 +++ b/libpurple/protocols/msn/session.c Wed Dec 02 02:46:59 2009 +0000 @@ -46,7 +46,7 @@ purple_account_get_username(account), NULL); session->oim = msn_oim_new(session); - session->protocol_ver = WLM_PROT_VER; + session->protocol_ver = 0; session->guid = rand_guid();