Mercurial > pidgin
changeset 20124:05726ea2dd89
Add disconnection reasons to oscar.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Mon, 01 Oct 2007 16:07:14 +0000 |
parents | b2c46103a5b4 |
children | 3e8531514ad7 |
files | libpurple/protocols/oscar/flap_connection.c libpurple/protocols/oscar/oscar.c |
diffstat | 2 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/flap_connection.c Mon Oct 01 14:54:31 2007 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Mon Oct 01 16:07:14 2007 +0000 @@ -380,7 +380,10 @@ { /* No more FLAP connections! Sign off this PurpleConnection! */ gchar *tmp; + PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + if (conn->disconnect_code == 0x0001) { + reason = PURPLE_REASON_NAME_IN_USE; tmp = g_strdup(_("You have signed on from another location.")); od->gc->wants_to_die = TRUE; } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) @@ -402,7 +405,7 @@ if (tmp != NULL) { - purple_connection_error(od->gc, tmp); + purple_connection_error_reason(od->gc, reason, tmp); g_free(tmp); } }
--- a/libpurple/protocols/oscar/oscar.c Mon Oct 01 14:54:31 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Mon Oct 01 16:07:14 2007 +0000 @@ -993,7 +993,7 @@ gchar *msg; msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"), error_message); - purple_connection_error(gc, msg); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg); g_free(msg); } else if (conn->type == SNAC_FAMILY_LOCATE) @@ -1001,7 +1001,7 @@ gchar *msg; msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"), error_message); - purple_connection_error(gc, msg); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg); g_free(msg); } else @@ -1257,7 +1257,7 @@ gchar *buf; buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); gc->wants_to_die = TRUE; - purple_connection_error(gc, buf); + purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, buf); g_free(buf); } @@ -1278,7 +1278,8 @@ connection_established_cb, newconn); if (newconn->connect_data == NULL) { - purple_connection_error(gc, _("Couldn't connect to host")); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + _("Couldn't connect to host")); return; } @@ -1340,42 +1341,42 @@ case 0x01: /* Unregistered screen name */ gc->wants_to_die = TRUE; - purple_connection_error(gc, _("Invalid screen name.")); + purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Invalid screen name.")); break; case 0x05: /* Incorrect password */ gc->wants_to_die = TRUE; if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error(gc, _("Incorrect password.")); + purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Incorrect password.")); break; case 0x11: /* Suspended account */ gc->wants_to_die = TRUE; - purple_connection_error(gc, _("Your account is currently suspended.")); + purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Your account is currently suspended.")); break; case 0x14: /* service temporarily unavailable */ - purple_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); break; case 0x18: /* screen name connecting too frequently */ gc->wants_to_die = TRUE; - purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); + purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; case 0x1c: /* client too old */ gc->wants_to_die = TRUE; g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE); - purple_connection_error(gc, buf); + purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, buf); break; case 0x1d: /* IP address connecting too frequently */ gc->wants_to_die = TRUE; - purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); + purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; default: - purple_connection_error(gc, _("Authentication failed")); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Authentication failed")); break; } purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); @@ -1405,7 +1406,7 @@ g_free(host); if (newconn->connect_data == NULL) { - purple_connection_error(gc, _("Could Not Connect")); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Could Not Connect")); return 0; } @@ -1431,7 +1432,8 @@ /* Disconnect */ gc->wants_to_die = TRUE; - purple_connection_error(gc, _("The SecurID key entered is invalid.")); + purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, + _("The SecurID key entered is invalid.")); } static int