Mercurial > pidgin
changeset 28912:c833ae72599b
oscar: Try to make the error message more verbose.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 27 Jan 2010 21:24:15 +0000 |
parents | a41724547756 |
children | 45123312b7a9 |
files | libpurple/protocols/oscar/clientlogin.c |
diffstat | 1 files changed, 30 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/clientlogin.c Tue Jan 26 19:26:36 2010 +0000 +++ b/libpurple/protocols/oscar/clientlogin.c Wed Jan 27 21:24:15 2010 +0000 @@ -62,6 +62,26 @@ DEFAULT_CLIENT_KEY); } +static gchar *generate_error_message(xmlnode *resp, const char *url) +{ + xmlnode *text; + gchar *err = NULL; + gchar *details = NULL; + + if (resp && (text = xmlnode_get_child(resp, "statusText"))) { + details = xmlnode_get_data(text); + } + + if (details && *details) { + err = g_strdup_printf(_("Received unexpected response from %s: %s"), url, details); + } else { + err = g_strdup_printf(_("Received unexpected response from %s"), url); + } + + g_free(details); + return err; +} + /** * @return A null-terminated base64 encoded version of the HMAC * calculated using the given key and data. @@ -121,7 +141,7 @@ purple_debug_error("oscar", "startOSCARSession could not parse " "response as XML: %s\n", response); /* Note to translators: %s in this string is a URL */ - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_START_OSCAR_SESSION); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -144,7 +164,7 @@ char *msg; purple_debug_error("oscar", "startOSCARSession response was " "missing statusCode: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_START_OSCAR_SESSION); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -169,7 +189,7 @@ "longer.")); else { char *msg; - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_START_OSCAR_SESSION); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); @@ -190,7 +210,7 @@ char *msg; purple_debug_error("oscar", "startOSCARSession response was missing " "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_START_OSCAR_SESSION); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -213,7 +233,7 @@ char *msg; purple_debug_error("oscar", "startOSCARSession response was missing " "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_START_OSCAR_SESSION); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -340,7 +360,7 @@ char *msg; purple_debug_error("oscar", "clientLogin could not parse " "response as XML: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_CLIENT_LOGIN); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -364,7 +384,7 @@ char *msg; purple_debug_error("oscar", "clientLogin response was " "missing statusCode: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_CLIENT_LOGIN); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -399,7 +419,7 @@ _("AOL does not allow your screen name to authenticate here")); } else { char *msg; - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_CLIENT_LOGIN); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); @@ -418,7 +438,7 @@ char *msg; purple_debug_error("oscar", "clientLogin response was missing " "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_CLIENT_LOGIN); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); @@ -436,7 +456,7 @@ char *msg; purple_debug_error("oscar", "clientLogin response was missing " "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), + msg = generate_error_message(response_node, URL_CLIENT_LOGIN); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg);