soc.2009.telepathy: 98c025cc: Use purple_connection_error_reason() ins...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Wed May 13 14:16:54 EDT 2009


-----------------------------------------------------------------
Revision: 98c025ccab7f5240486c1754f58071707ff25903
Ancestor: 4c9717d51a5e63b0e733ea7194234e1c222aac0b
Author: sttwister at soc.pidgin.im
Date: 2009-05-13T18:12:42
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/98c025ccab7f5240486c1754f58071707ff25903

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Use purple_connection_error_reason() instead of purple_connection_error()

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	55f1e35cc436a6be4bf2035ec4386a34c3f85e70
+++ libpurple/protocols/telepathy/telepathy.c	82c9c0de9d753156642ecbf85a4678a2ce20dd52
@@ -173,6 +173,7 @@ status_changed_cb (TpConnection *proxy,
 	else if (arg_Status == TP_CONNECTION_STATUS_DISCONNECTED)
 	{
 		gchar *reason = NULL;
+		PurpleConnectionError error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
 		purple_debug_info("telepathy", "Disconnected! Reason: %d\n", arg_Reason);
 
 		purple_connection_set_state(data->gc, PURPLE_DISCONNECTED);
@@ -181,56 +182,74 @@ status_changed_cb (TpConnection *proxy,
 		{
 			case 2:
 				reason = "Network error";
+				error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 			break;
 
 			case 3:
 				reason = "Authentication failed";
+				error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 			break;
 
 			case 4:
 				reason = "Encryption error";
+				error = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR;
 			break;
 
 			case 5:
 				reason = "Name in use";
+				error = PURPLE_CONNECTION_ERROR_NAME_IN_USE;
 			break;
 
 			case 6:
 				reason = "SSL Certificate not provided";
+				error = PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED;
 			break;
 
 			case 7:
 				reason = "SSL Certificate is isnged by an untrusted certifying authority";
+				error = PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED;
 			break;
 
 			case 8:
 				reason = "SSL Certificate expired";
+				error = PURPLE_CONNECTION_ERROR_CERT_EXPIRED;
 			break;
 
 			case 9:
 				reason = "SSL Certificate is not yet valid";
+				error = PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED;
 			break;
 
 			case 10:
 				reason = "SSL Certificate hostname mismatch";
+				error = PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH;
 			break;
 
 			case 11:
 				reason = "SSL Certificate fingerprint mismatch";
+				error = PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH;
 			break;
 
 			case 12:
 				reason = "SSL Certificate is self-signed";
+				error = PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED;
 			break;
 
 			case 13:
 				reason = "Error while validating the server's SSL Certificate";
+				error = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR;
 			break;
 		}
 
 		if (reason != NULL)
-			purple_connection_error(data->gc, reason);
+			purple_connection_error_reason(data->gc, error, reason);
 
+		if (data->connection)
+		{
+			g_object_unref(data->connection);
+			data->connection = NULL;
+		}
+
 	}
 	else if (arg_Status == TP_CONNECTION_STATUS_CONNECTING)
 	{
@@ -289,12 +308,11 @@ request_connection_cb (TpConnectionManag
 
 		if (error != NULL)
 		{
-			purple_debug_error("telepathy", "Error creating TpConenction object: %s\n", error->message);
+			purple_debug_error("telepathy", "Error creating TpConnection object: %s\n", error->message);
 			g_error_free(error);
 			return;
 		}
 
-		/* this will indicate that we are actually connected */
 		tp_connection_call_when_ready(data->connection, connection_ready_cb, plugin);
 
 		/* this will indicate any connection status change, also providing a reason */


More information about the Commits mailing list