im.pidgin.cpw.resiak.disconnectreason: 82104c5eaf51d1fb4fb9009a8e04a0384712531a

resiak at soc.pidgin.im resiak at soc.pidgin.im
Sun Nov 11 17:35:53 EST 2007


-----------------------------------------------------------------
Revision: 82104c5eaf51d1fb4fb9009a8e04a0384712531a
Ancestor: 8dd1c3bae575806fdbbaf15b21ff9b9ad63b2156
Author: resiak at soc.pidgin.im
Date: 2007-11-11T22:18:20
Branch: im.pidgin.cpw.resiak.disconnectreason

Modified files:
        libpurple/protocols/msnp9/msn.c
        libpurple/protocols/msnp9/session.c
        libpurple/protocols/silc/silc.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msnp9/msn.c	2c1978cae8fe46637c0d1be77779e37e35c8b6ee
+++ libpurple/protocols/msnp9/msn.c	f11ad08c82dae188055e4ea33a9ea95c13d3f788
@@ -725,8 +725,9 @@ msn_login(PurpleAccount *account)
 
 	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 @@ msn_login(PurpleAccount *account)
 		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
============================================================
--- libpurple/protocols/msnp9/session.c	c00810400b189db9e2a3ffa25f1f430d41561bd1
+++ libpurple/protocols/msnp9/session.c	94fcebb353868bed5a45c468478dc70b3569e87a
@@ -286,6 +286,7 @@ msn_session_set_error(MsnSession *sessio
 					  const char *info)
 {
 	PurpleConnection *gc;
+	PurpleConnectionError reason;
 	char *msg;
 
 	gc = purple_account_get_connection(session->account);
@@ -293,47 +294,56 @@ msn_session_set_error(MsnSession *sessio
 	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);
 }
============================================================
--- libpurple/protocols/silc/silc.c	fbc03fc8a15d9c5098d5f36c456d907e830a546f
+++ libpurple/protocols/silc/silc.c	21b04725819c816a7ed9d0856996742e0d511e80
@@ -368,7 +368,9 @@ silcpurple_stream_created(SilcSocketStre
 	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 @@ silcpurple_login(PurpleAccount *account)
 	/* 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;


More information about the Commits mailing list