im.pidgin.pidgin: 9b5113d625c9c16b41531d47aed53f0dfc2c6a84

resiak at soc.pidgin.im resiak at soc.pidgin.im
Thu Jan 31 12:45:53 EST 2008


-----------------------------------------------------------------
Revision: 9b5113d625c9c16b41531d47aed53f0dfc2c6a84
Ancestor: 459f009bbc5c632b8f92f56fc2fc0239f207994c
Author: resiak at soc.pidgin.im
Date: 2008-01-31T17:43:14
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/silc10/ops.c
        libpurple/protocols/silc10/silc.c

ChangeLog: 

Update silc10 to use purple_connection_error_reason(), matching the uses in
silc.

-------------- next part --------------
============================================================
--- libpurple/protocols/silc10/ops.c	7e384f1e31cdbe9587f72f5f577b4178a1517ae4
+++ libpurple/protocols/silc10/ops.c	b78f2b937f35a46d64d787623d8114094d119b95
@@ -1697,27 +1697,32 @@ silc_connected(SilcClient client, SilcCl
 		return;
 		break;
 	case SILC_CLIENT_CONN_ERROR:
-		purple_connection_error(gc, _("Error during connecting to SILC Server"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+			_("Error during connecting to SILC Server"));
 		g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
 		break;
 
 	case SILC_CLIENT_CONN_ERROR_KE:
-		purple_connection_error(gc, _("Key Exchange failed"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
+			_("Key Exchange failed"));
 		break;
 
 	case SILC_CLIENT_CONN_ERROR_AUTH:
-		purple_connection_error(gc, _("Authentication failed"));
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
+			_("Authentication failed"));
 		break;
 
 	case SILC_CLIENT_CONN_ERROR_RESUME:
-		purple_connection_error(gc,
-				      _("Resuming detached session failed. "
-					"Press Reconnect to create new connection."));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+			_("Resuming detached session failed. "
+			  "Press Reconnect to create new connection."));
 		g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
 		break;
 
 	case SILC_CLIENT_CONN_ERROR_TIMEOUT:
-		purple_connection_error(gc, _("Connection Timeout"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+			_("Connection Timeout"));
 		break;
 	}
 
@@ -1746,7 +1751,8 @@ silc_disconnected(SilcClient client, Sil
 
 	/* Close the connection */
 	if (!sg->detaching)
-		purple_connection_error(gc, _("Disconnected by server"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+			_("Disconnected by server"));
 	else
 		/* TODO: Does this work correctly? Maybe we need to set wants_to_die? */
 		purple_account_disconnect(purple_connection_get_account(gc));
============================================================
--- libpurple/protocols/silc10/silc.c	e2cbd4d2eb8570facfd77d712f3e14202859fa55
+++ libpurple/protocols/silc10/silc.c	e355589dff37f1cc90e67cbcaaf957b4a18c2851
@@ -158,7 +158,9 @@ silcpurple_login_connected(gpointer data
 	sg = gc->proto_data;
 
 	if (source < 0) {
-		purple_connection_error(gc, _("Connection failed"));
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+			_("Connection failed"));
 		return;
 	}
 
@@ -179,7 +181,8 @@ silcpurple_login_connected(gpointer data
 							  "silc.silcnet.org"),
 			  purple_account_get_int(account, "port", 706), sg);
 	if (!conn) {
-		purple_connection_error(gc, _("Cannot initialize SILC Client connection"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+			_("Cannot initialize SILC Client connection"));
 		gc->proto_data = NULL;
 		return;
 	}
@@ -264,7 +267,8 @@ silcpurple_login(PurpleAccount *account)
 	/* Allocate SILC client */
 	client = silc_client_alloc(&ops, &params, gc, NULL);
 	if (!client) {
-		purple_connection_error(gc, _("Out of memory"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+		                             _("Out of memory"));
 		return;
 	}
 
@@ -309,15 +313,15 @@ silcpurple_login(PurpleAccount *account)
 
 	/* Init SILC client */
 	if (!silc_client_init(client)) {
-		gc->wants_to_die = TRUE;
-		purple_connection_error(gc, _("Cannot initialize SILC protocol"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+		                             _("Cannot initialize SILC protocol"));
 		return;
 	}
 
 	/* Check the ~/.silc dir and create it, and new key pair if necessary. */
 	if (!silcpurple_check_silc_dir(gc)) {
-		gc->wants_to_die = TRUE;
-		purple_connection_error(gc, _("Cannot find/access ~/.silc directory"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+		                             _("Error loading SILC key pair"));
 		return;
 	}
 
@@ -332,7 +336,8 @@ silcpurple_login(PurpleAccount *account)
 				(gc->password == NULL) ? "" : gc->password, &client->pkcs,
 				&client->public_key, &client->private_key)) {
 		g_snprintf(pkd, sizeof(pkd), _("Could not load SILC key pair: %s"), g_strerror(errno));
-		purple_connection_error(gc, pkd);
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+		                             _("Could not load SILC key pair"));
 		return;
 	}
 
@@ -352,7 +357,8 @@ silcpurple_login(PurpleAccount *account)
 			       purple_account_get_int(account, "port", 706),
 			       silcpurple_login_connected, gc) == NULL)
 	{
-		purple_connection_error(gc, _("Unable to create connection"));
+		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+		                             _("Unable to create connection"));
 		return;
 	}
 


More information about the Commits mailing list