Mercurial > pidgin.yaz
diff libpurple/protocols/novell/novell.c @ 20776:f3cfcbbac3d8
propagate from branch 'im.pidgin.pidgin' (head 294731552d0baf5f1f37a45e0c119b2188f34ba8)
to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 548e06334e7772c9583776ecbd80e8d2a68fcd79)
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Fri, 05 Oct 2007 15:50:17 +0000 |
parents | 5723dbc6212d b2c46103a5b4 |
children | 8174f6999308 |
line wrap: on
line diff
--- a/libpurple/protocols/novell/novell.c Thu Oct 04 03:52:47 2007 +0000 +++ b/libpurple/protocols/novell/novell.c Fri Oct 05 15:50:17 2007 +0000 @@ -120,21 +120,28 @@ _check_for_disconnect(user, rc); } else { - + PurpleDisconnectReason reason; char *err = g_strdup_printf(_("Login failed (%s)."), nm_error_to_string (ret_code)); - /* Don't attempt to auto-reconnect if our password - * was invalid. - */ - if (ret_code == NMERR_AUTHENTICATION_FAILED || - ret_code == NMERR_CREDENTIALS_MISSING || - ret_code == NMERR_PASSWORD_INVALID) { - if (!purple_account_get_remember_password(gc->account)) - purple_account_set_password(gc->account, NULL); - gc->wants_to_die = TRUE; + switch (ret_code) { + case NMERR_AUTHENTICATION_FAILED: + case NMERR_CREDENTIALS_MISSING: + case NMERR_PASSWORD_INVALID: + /* Don't attempt to auto-reconnect if our + * password was invalid. + */ + if (!purple_account_get_remember_password(gc->account)) + purple_account_set_password(gc->account, NULL); + gc->wants_to_die = TRUE; + reason = PURPLE_REASON_AUTHENTICATION_FAILED; + break; + default: + /* FIXME: There are other reasons login could fail */ + reason = PURPLE_REASON_NETWORK_ERROR; } - purple_connection_error(gc, err); + + purple_connection_error_reason (gc, reason, err); g_free(err); } } @@ -1120,8 +1127,8 @@ if (_is_disconnect_error(err)) { - purple_connection_error(gc, _("Error communicating with server." - " Closing connection.")); + purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + _("Error communicating with server. Closing connection.")); return TRUE; } @@ -1667,7 +1674,7 @@ user = gc->proto_data; user->conn->ssl_conn->data = NULL; - purple_connection_error(gc, _("Unable to make SSL connection to server.")); + purple_connection_ssl_error (gc, error); } static void @@ -1690,9 +1697,9 @@ if (_is_disconnect_error(rc)) { - purple_connection_error(gc, - _("Error communicating with server." - " Closing connection.")); + purple_connection_error_reason (gc, + PURPLE_REASON_NETWORK_ERROR, + _("Error communicating with server. Closing connection.")); } else { purple_debug(PURPLE_DEBUG_INFO, "novell", "Error processing event or response (%d).\n", rc); @@ -1731,7 +1738,8 @@ conn->connected = TRUE; purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); } else { - purple_connection_error(gc, _("Unable to connect to server.")); + purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + _("Unable to connect to server.")); } purple_connection_update_progress(gc, _("Waiting for response..."), @@ -2014,7 +2022,8 @@ gc->wants_to_die = TRUE; /* we don't want to reconnect in this case */ if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error(gc, _("You have been logged out because you" + purple_connection_error_reason (gc, PURPLE_REASON_NAME_IN_USE, + _("You have been logged out because you" " logged in at another workstation.")); } } @@ -2169,9 +2178,9 @@ */ /* ...but for now just error out with a nice message. */ - purple_connection_error(gc, _("Unable to connect to server." - " Please enter the address of the server" - " you wish to connect to.")); + purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, + _("Unable to connect to server. Please enter the " + "address of the server you wish to connect to.")); return; } @@ -2197,8 +2206,9 @@ user->conn->addr, user->conn->port, novell_ssl_connected_cb, novell_ssl_connect_error, gc); if (user->conn->ssl_conn->data == NULL) { - purple_connection_error(gc, _("Error." - " SSL support is not installed.")); + purple_connection_error_reason (gc, + PURPLE_REASON_ENCRYPTION_ERROR, + _("Error. SSL support is not installed.")); } } }