diff libpurple/protocols/jabber/auth.c @ 27463:f541583e31bd

More uniformity among disconnect error messages
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 09:07:42 +0000
parents c4e5ba03ff73
children c585572e80dd
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c	Mon Jul 06 07:26:12 2009 +0000
+++ b/libpurple/protocols/jabber/auth.c	Mon Jul 06 09:07:42 2009 +0000
@@ -52,12 +52,12 @@
 					"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
 			return TRUE;
 		} else if(xmlnode_get_child(starttls, "required")) {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason(js->gc,
 				PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
 				_("Server requires TLS/SSL, but no TLS/SSL support was found."));
 			return TRUE;
 		} else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE)) {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason(js->gc,
 				 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
 				_("You require encryption, but no TLS/SSL support was found."));
 			return TRUE;
@@ -122,7 +122,7 @@
 
 static void disallow_plaintext_auth(PurpleAccount *account)
 {
-	purple_connection_error_reason (account->gc,
+	purple_connection_error_reason(account->gc,
 		PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
 		_("Server requires plaintext authentication over an unencrypted stream"));
 }
@@ -415,7 +415,7 @@
 		jabber_send(js, auth);
 		xmlnode_free(auth);
 	} else {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 			_("SASL authentication failed"));
 	}
@@ -490,9 +490,9 @@
 	mechs = xmlnode_get_child(packet, "mechanisms");
 
 	if(!mechs) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-			_("Invalid response from server."));
+			_("Invalid response from server"));
 		return;
 	}
 
@@ -561,7 +561,7 @@
 		}
 		finish_plaintext_authentication(js);
 	} else {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason(js->gc,
 				PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 				_("Server does not use any supported authentication method"));
 	}
@@ -590,7 +590,7 @@
 				purple_account_set_password(js->gc->account, NULL);
 		}
 
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason(js->gc, reason, msg);
 		g_free(msg);
 	}
 }
@@ -606,7 +606,7 @@
 	if (type == JABBER_IQ_ERROR) {
 		PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 		char *msg = jabber_parse_error(js, packet, &reason);
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason(js->gc, reason, msg);
 		g_free(msg);
 	} else if (type == JABBER_IQ_RESULT) {
 		query = xmlnode_get_child(packet, "query");
@@ -676,7 +676,7 @@
 			}
 			finish_plaintext_authentication(js);
 		} else {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason(js->gc,
 				PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 				_("Server does not use any supported authentication method"));
 			return;
@@ -695,7 +695,7 @@
 	 */
 	if (!jabber_stream_is_ssl(js) &&
 			purple_account_get_bool(purple_connection_get_account(js->gc), "require_tls", FALSE)) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
 			_("You require encryption, but it is not available on this server."));
 		return;
@@ -856,9 +856,9 @@
 		GHashTable *parts;
 
 		if(!enc_in) {
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason(js->gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Invalid response from server."));
+				_("Invalid response from server"));
 			return;
 		}
 
@@ -879,7 +879,7 @@
 						"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
 						-1);
 			} else {
-				purple_connection_error_reason (js->gc,
+				purple_connection_error_reason(js->gc,
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Invalid challenge from server"));
 			}
@@ -905,7 +905,7 @@
 				realm = js->user->domain;
 
 			if (nonce == NULL || realm == NULL)
-				purple_connection_error_reason (js->gc,
+				purple_connection_error_reason(js->gc,
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Invalid challenge from server"));
 			else {
@@ -980,10 +980,13 @@
 		g_free(enc_in);
 		g_free(dec_in);
 		if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) {
-			purple_debug_error("jabber", "Error is %d : %s\n",js->sasl_state,sasl_errdetail(js->sasl));
-			purple_connection_error_reason (js->gc,
-				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("SASL error"));
+			gchar *tmp = g_strdup_printf(_("SASL error: %s"),
+					sasl_errdetail(js->sasl));
+			purple_debug_error("jabber", "Error is %d : %s\n",
+					js->sasl_state, sasl_errdetail(js->sasl));
+			purple_connection_error_reason(js->gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
+			g_free(tmp);
 			return;
 		} else {
 			response = xmlnode_new("response");
@@ -1025,9 +1028,9 @@
 #endif
 
 	if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-			_("Invalid response from server."));
+			_("Invalid response from server"));
 		return;
 	}
 
@@ -1052,9 +1055,9 @@
 
 		if (js->sasl_state != SASL_OK) {
 			/* This should never happen! */
-			purple_connection_error_reason (js->gc,
+			purple_connection_error_reason(js->gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Invalid response from server."));
+				_("Invalid response from server"));
 		}
 	}
 	/* If we've negotiated a security layer, we need to enable it */
@@ -1098,11 +1101,11 @@
 #endif
 	msg = jabber_parse_error(js, packet, &reason);
 	if(!msg) {
-		purple_connection_error_reason (js->gc,
+		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-			_("Invalid response from server."));
+			_("Invalid response from server"));
 	} else {
-		purple_connection_error_reason (js->gc, reason, msg);
+		purple_connection_error_reason(js->gc, reason, msg);
 		g_free(msg);
 	}
 }