# HG changeset patch # User Will Thompson # Date 1194819500 0 # Node ID 73788974b8831ee9af8d6ac98ca9342dcc102f27 # Parent 3c0b20dd2805c043d8fd9d75f72bd6b9502ff6c1 Switch to purple_connection_error_reason in msnp9, and a few places I missed in silc. I've still not reason-ified silc10 or zephyr or toc. diff -r 3c0b20dd2805 -r 73788974b883 libpurple/protocols/msnp9/msn.c --- a/libpurple/protocols/msnp9/msn.c Sun Nov 11 22:09:49 2007 +0000 +++ b/libpurple/protocols/msnp9/msn.c Sun Nov 11 22:18:20 2007 +0000 @@ -725,8 +725,9 @@ if (!purple_ssl_is_supported()) { - gc->wants_to_die = TRUE; - purple_connection_error(gc, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, + _("SSL support is needed for MSN. Please install a supported " "SSL library.")); return; @@ -755,7 +756,9 @@ purple_account_set_username(account, username); if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error(gc, _("Failed to connect to server.")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Failed to connect to server.")); } static void diff -r 3c0b20dd2805 -r 73788974b883 libpurple/protocols/msnp9/session.c --- a/libpurple/protocols/msnp9/session.c Sun Nov 11 22:09:49 2007 +0000 +++ b/libpurple/protocols/msnp9/session.c Sun Nov 11 22:18:20 2007 +0000 @@ -286,6 +286,7 @@ const char *info) { PurpleConnection *gc; + PurpleConnectionError reason; char *msg; gc = purple_account_get_connection(session->account); @@ -293,47 +294,56 @@ switch (error) { case MSN_ERROR_SERVCONN: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(info); break; case MSN_ERROR_UNSUPPORTED_PROTOCOL: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Our protocol is not supported by the " "server.")); break; case MSN_ERROR_HTTP_MALFORMED: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Error parsing HTTP.")); break; case MSN_ERROR_SIGN_OTHER: - gc->wants_to_die = TRUE; + reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; msg = g_strdup(_("You have signed on from another location.")); + if (!purple_account_get_remember_password(session->account)) + purple_account_set_password(session->account, NULL); break; case MSN_ERROR_SERV_UNAVAILABLE: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("The MSN servers are temporarily " "unavailable. Please wait and try " "again.")); break; case MSN_ERROR_SERV_DOWN: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("The MSN servers are going down " "temporarily.")); break; case MSN_ERROR_AUTH: - gc->wants_to_die = TRUE; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; msg = g_strdup_printf(_("Unable to authenticate: %s"), (info == NULL ) ? _("Unknown error") : info); break; case MSN_ERROR_BAD_BLIST: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Your MSN buddy list is temporarily " "unavailable. Please wait and try " "again.")); break; default: + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Unknown error.")); break; } msn_session_disconnect(session); - purple_connection_error(gc, msg); + purple_connection_error_reason (gc, reason, msg); g_free(msg); } diff -r 3c0b20dd2805 -r 73788974b883 libpurple/protocols/silc/silc.c --- a/libpurple/protocols/silc/silc.c Sun Nov 11 22:09:49 2007 +0000 +++ b/libpurple/protocols/silc/silc.c Sun Nov 11 22:18:20 2007 +0000 @@ -368,7 +368,9 @@ sg = gc->proto_data; if (status != SILC_SOCKET_OK) { - purple_connection_error(gc, _("Connection failed")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Connection failed")); silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); @@ -544,8 +546,8 @@ /* Init SILC client */ if (!silc_client_init(client, username, hostname, realname, silcpurple_running, sg)) { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Cannot initialize SILC protocol")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Cannot initialize SILC protocol")); gc->proto_data = NULL; silc_free(sg); return;