pidgin: 4cc28a24: Gadu-Gadu: detailed descriptions on conn...

tomkiewicz at cpw.pidgin.im tomkiewicz at cpw.pidgin.im
Sat Oct 8 18:55:47 EDT 2011


----------------------------------------------------------------------
Revision: 4cc28a24626e194d1d3ee46451586ff31a665317
Parent:   8b743886b15889fc6c62a9bff8bd9c208554a3be
Author:   tomkiewicz at cpw.pidgin.im
Date:     10/08/11 18:53:35
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4cc28a24626e194d1d3ee46451586ff31a665317

Changelog: 

Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648

Changes against parent 8b743886b15889fc6c62a9bff8bd9c208554a3be

  patched  ChangeLog
  patched  libpurple/protocols/gg/gg.c

-------------- next part --------------
============================================================
--- ChangeLog	4386ab53b18805e7b5c2e4f16dd552d3cff1bbe1
+++ ChangeLog	45e89201b1cad66e36c7413cc16c3fbf83594ffb
@@ -10,6 +10,8 @@ version 3.0.0 (??/??/????):
 	* Possibility to require encryption. Also, using encryption when
 	  available is default option now. (Tomasz Wasilczyk)
 	* Show local time for incoming messages. (Tomasz Wasilczyk) (#4579)
+	* Detailed descriptions on connection failures. (Tomasz Wasilczyk)
+	  (#14648)
 
 	MXit:
 	* Remove all reference to Hidden Number.
============================================================
--- libpurple/protocols/gg/gg.c	01a176bf7aac37ed37cb2be71cbbbc411d8b03b0
+++ libpurple/protocols/gg/gg.c	d2e1ecc208f3647960cf622084719cd310b97b77
@@ -1932,9 +1932,56 @@ static void ggp_async_login_handler(gpoi
 		case GG_EVENT_CONN_FAILED:
 			purple_input_remove(gc->inpa);
 			gc->inpa = 0;
-			purple_connection_error (gc,
-				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Connection failed"));
+			purple_debug_info("gg", "Connection failure: %d\n",
+				ev->event.failure);
+			switch (ev->event.failure) {
+				case GG_FAILURE_RESOLVING:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+						_("Unable to resolve "
+						"hostname"));
+					break;
+				case GG_FAILURE_PASSWORD:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
+						_("Incorrect password"));
+					break;
+				case GG_FAILURE_TLS:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
+						_("SSL Connection Failed"));
+					break;
+				case GG_FAILURE_INTRUDER:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
+						_("Your account has been "
+						"disabled because too many "
+						"incorrect passwords were "
+						"entered"));
+					break;
+				case GG_FAILURE_UNAVAILABLE:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+						_("Service temporarily "
+						"unavailable"));
+					break;
+				case GG_FAILURE_PROXY:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+						_("Error connecting to proxy "
+						"server"));
+					break;
+				case GG_FAILURE_HUB:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+						_("Error connecting to master "
+						"server"));
+					break;
+				default:
+					purple_connection_error(gc,
+						PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+						_("Connection failed"));
+			}
 			break;
 		case GG_EVENT_MSG:
 			if (ev->event.msg.sender == 0)
@@ -2137,6 +2184,15 @@ static void ggp_login(PurpleAccount *acc
 
 	glp->uin = ggp_get_uin(account);
 	glp->password = (char *)purple_account_get_password(account);
+
+	if (glp->uin == 0) {
+		purple_connection_error(gc,
+			PURPLE_CONNECTION_ERROR_INVALID_USERNAME,
+			_("The username specified is invalid."));
+		g_free(glp);
+		return;
+	}
+
 	glp->image_size = 255;
 
 	presence = purple_account_get_presence(account);
@@ -2155,12 +2211,10 @@ static void ggp_login(PurpleAccount *acc
 		encryption_type);
 	if (strcmp(encryption_type, "opportunistic_tls") == 0)
 		glp->tls = GG_SSL_ENABLED;
-	else if (strcmp(encryption_type, "require_tls") == 0)
-	{
+	else if (strcmp(encryption_type, "require_tls") == 0) {
 		if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL))
 			glp->tls = GG_SSL_REQUIRED;
-		else
-		{
+		else {
 			purple_connection_error(gc,
 				PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
 				_("SSL support unavailable"));


More information about the Commits mailing list