Beispiel #1
0
static void
msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response,
	gpointer req_data)
{
	MsnOimRequestData *data = (MsnOimRequestData *)req_data;
	xmlnode *fault = NULL;
	xmlnode *faultcode = NULL;

	if (response == NULL)
		return;

	fault = xmlnode_get_child(response->xml, "Body/Fault");
	if (fault)
		faultcode = xmlnode_get_child(fault, "faultcode");

	if (faultcode) {
		gchar *faultcode_str = xmlnode_get_data(faultcode);

		if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) {
			purple_debug_warning("msn", "OIM Request Error, Updating token now.\n");
			msn_nexus_update_token(data->oim->session->nexus,
				data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB,
				(GSourceFunc)msn_oim_request_helper, data);
			g_free(faultcode_str);
			return;

		} else if (faultcode_str && g_str_equal(faultcode_str, "q0:AuthenticationFailed")) {
			if (xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) {
				purple_debug_warning("msn", "OIM Request Error, Updating token now.\n");
				msn_nexus_update_token(data->oim->session->nexus,
					data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB,
					(GSourceFunc)msn_oim_request_helper, data);
				g_free(faultcode_str);
				return;
			}
		}
		g_free(faultcode_str);
	}

	if (data->cb)
		data->cb(request, response, data->cb_data);
	xmlnode_free(data->body);
	g_free(data);
}
Beispiel #2
0
static void
msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response,
                   gpointer req_data)
{
    MsnOimRequestData *data = (MsnOimRequestData *)req_data;
    PurpleXmlNode *fault = NULL;
    PurpleXmlNode *faultcode = NULL;

    if (response != NULL)
        fault = purple_xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault");

    if (fault && (faultcode = purple_xmlnode_get_child(fault, "faultcode"))) {
        gchar *faultcode_str = purple_xmlnode_get_data(faultcode);
        gboolean need_token_update = FALSE;

        if (faultcode_str) {
            if (g_str_equal(faultcode_str, "q0:BadContextToken") ||
                    g_str_equal(faultcode_str, "AuthenticationFailed") ||
                    g_str_equal(faultcode_str, "s:AuthenticationFailed"))
                need_token_update = TRUE;
            else if (g_str_equal(faultcode_str, "q0:AuthenticationFailed") &&
                     purple_xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL)
                need_token_update = TRUE;
        }

        if (need_token_update) {
            purple_debug_warning("msn", "OIM Request Error, Updating token now.\n");
            msn_nexus_update_token(data->oim->session->nexus,
                                   data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB,
                                   (GSourceFunc)msn_oim_request_helper, data);
            g_free(faultcode_str);
            return;

        }

        g_free(faultcode_str);
    }

    if (data->cb)
        data->cb(request, response, data->cb_data);
    purple_xmlnode_free(data->body);
    g_free(data);
}