changeset 20120:557c4c67bd29

Use purple_connection_error_reason in prpl-msn.
author Will Thompson <will.thompson@collabora.co.uk>
date Wed, 19 Sep 2007 16:38:33 +0000
parents ec3471ab96d6
children e4bcdd9622c2
files libpurple/protocols/msn/msn.c libpurple/protocols/msn/session.c
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Wed Sep 19 15:16:32 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Wed Sep 19 16:38:33 2007 +0000
@@ -722,7 +722,7 @@
 	if (!purple_ssl_is_supported())
 	{
 		gc->wants_to_die = TRUE;
-		purple_connection_error(gc,
+		purple_connection_error_reason (gc, PURPLE_REASON_ENCRYPTION_ERROR,
 			_("SSL support is needed for MSN. Please install a supported "
 			  "SSL library."));
 		return;
@@ -751,7 +751,8 @@
 		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_REASON_NETWORK_ERROR,
+			_("Failed to connect to server."));
 }
 
 static void
--- a/libpurple/protocols/msn/session.c	Wed Sep 19 15:16:32 2007 +0000
+++ b/libpurple/protocols/msn/session.c	Wed Sep 19 16:38:33 2007 +0000
@@ -286,6 +286,7 @@
 					  const char *info)
 {
 	PurpleConnection *gc;
+	PurpleDisconnectReason reason;
 	char *msg;
 
 	gc = purple_account_get_connection(session->account);
@@ -293,47 +294,56 @@
 	switch (error)
 	{
 		case MSN_ERROR_SERVCONN:
+			reason = PURPLE_REASON_NETWORK_ERROR;
 			msg = g_strdup(info);
 			break;
 		case MSN_ERROR_UNSUPPORTED_PROTOCOL:
+			reason = PURPLE_REASON_NETWORK_ERROR;
 			msg = g_strdup(_("Our protocol is not supported by the "
 							 "server."));
 			break;
 		case MSN_ERROR_HTTP_MALFORMED:
+			reason = PURPLE_REASON_NETWORK_ERROR;
 			msg = g_strdup(_("Error parsing HTTP."));
 			break;
 		case MSN_ERROR_SIGN_OTHER:
 			gc->wants_to_die = TRUE;
+			reason = PURPLE_REASON_NAME_IN_USE;
 			msg = g_strdup(_("You have signed on from another location."));
 			break;
 		case MSN_ERROR_SERV_UNAVAILABLE:
+			reason = PURPLE_REASON_NETWORK_ERROR;
 			msg = g_strdup(_("The MSN servers are temporarily "
 							 "unavailable. Please wait and try "
 							 "again."));
 			break;
 		case MSN_ERROR_SERV_DOWN:
+			reason = PURPLE_REASON_NETWORK_ERROR;
 			msg = g_strdup(_("The MSN servers are going down "
 							 "temporarily."));
 			break;
 		case MSN_ERROR_AUTH:
+			reason = PURPLE_REASON_AUTHENTICATION_FAILED;
 			gc->wants_to_die = TRUE;
 			msg = g_strdup_printf(_("Unable to authenticate: %s"),
 								  (info == NULL ) ?
 								  _("Unknown error") : info);
 			break;
 		case MSN_ERROR_BAD_BLIST:
+			reason = PURPLE_REASON_NETWORK_ERROR;
 			msg = g_strdup(_("Your MSN buddy list is temporarily "
 							 "unavailable. Please wait and try "
 							 "again."));
 			break;
 		default:
+			reason = PURPLE_REASON_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);
 }