im.pidgin.cpw.resiak.disconnectreason: 22f81dcf0b879694d702cf62e553645025734319

resiak at soc.pidgin.im resiak at soc.pidgin.im
Wed Oct 3 13:56:01 EDT 2007


revision:            22f81dcf0b879694d702cf62e553645025734319
date:                2007-10-03T13:12:39
author:              resiak at soc.pidgin.im
branch:              im.pidgin.cpw.resiak.disconnectreason
changelog:
Add disconnection reasons to silc.

manifest:
format_version "1"

new_manifest [5dcfac819dfdc53db0dc9430cd8b35a4123b61f9]

old_revision [29b0f8b3c20bd9ded62d3a2bf11afc854d3513fd]

patch "libpurple/protocols/silc/silc.c"
 from [8d0a3d182b1aab7a03c61b577fd46db1440505ad]
   to [e5a0e121aa4380f573b2648d695505dd2ea891a4]

patch "libpurple/protocols/silc/util.c"
 from [dc180615f15f1f5b3128810202d21d5a06061a7b]
   to [59ef50b5eae7e4de46d5e69bd3d2ae5aca8106e9]
-------------- next part --------------
#
#
# patch "libpurple/protocols/silc/silc.c"
#  from [8d0a3d182b1aab7a03c61b577fd46db1440505ad]
#    to [e5a0e121aa4380f573b2648d695505dd2ea891a4]
# 
# patch "libpurple/protocols/silc/util.c"
#  from [dc180615f15f1f5b3128810202d21d5a06061a7b]
#    to [59ef50b5eae7e4de46d5e69bd3d2ae5aca8106e9]
#
============================================================
--- libpurple/protocols/silc/silc.c	8d0a3d182b1aab7a03c61b577fd46db1440505ad
+++ libpurple/protocols/silc/silc.c	e5a0e121aa4380f573b2648d695505dd2ea891a4
@@ -214,34 +214,40 @@ silcpurple_connect_cb(SilcClient client,
 
 		/* Close the connection */
 		if (!sg->detaching)
-		  purple_connection_error(gc, _("Disconnected by server"));
+		  purple_connection_error_reason(gc,
+		                                 PURPLE_REASON_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));
 		break;
 
 	case SILC_CLIENT_CONN_ERROR:
-		purple_connection_error(gc, _("Error during connecting to SILC Server"));
+		purple_connection_error_reason(gc, PURPLE_REASON_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_REASON_ENCRYPTION_ERROR,
+		                             _("Key Exchange failed"));
 		break;
 
 	case SILC_CLIENT_CONN_ERROR_AUTH:
-		purple_connection_error(gc, _("Authentication failed"));
+		purple_connection_error_reason(gc, PURPLE_REASON_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_REASON_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_REASON_NETWORK_ERROR,
+		                             _("Connection Timeout"));
 		break;
 	}
 
@@ -262,7 +268,8 @@ 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_REASON_NETWORK_ERROR,
+		                             _("Connection failed"));
 		silc_pkcs_public_key_free(sg->public_key);
 		silc_pkcs_private_key_free(sg->private_key);
 		silc_free(sg);
@@ -308,7 +315,8 @@ silcpurple_login_connected(gpointer data
 	sg = gc->proto_data;
 
 	if (source < 0) {
-		purple_connection_error(gc, _("Connection failed"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+		                             _("Connection failed"));
 		silc_pkcs_public_key_free(sg->public_key);
 		silc_pkcs_private_key_free(sg->private_key);
 		silc_free(sg);
@@ -349,8 +357,8 @@ static void silcpurple_running(SilcClien
 				(char *)purple_account_get_string(account, "private-key", prd),
 				(gc->password == NULL) ? "" : gc->password,
 				&sg->public_key, &sg->private_key)) {
-		g_snprintf(pkd, sizeof(pkd), _("Could not load SILC key pair"));
-		purple_connection_error(gc, pkd);
+		purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR,
+		                             _("Could not load SILC key pair"));
 		gc->proto_data = NULL;
 		silc_free(sg);
 		return;
@@ -363,7 +371,8 @@ static void silcpurple_running(SilcClien
 				 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_REASON_NETWORK_ERROR,
+		                             _("Unable to create connection"));
 		gc->proto_data = NULL;
 		silc_free(sg);
 		return;
@@ -392,7 +401,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_REASON_OTHER_ERROR,
+		                             _("Out of memory"));
 		return;
 	}
 
@@ -435,14 +445,16 @@ silcpurple_login(PurpleAccount *account)
 	if (!silc_client_init(client, username, hostname, realname,
 			      silcpurple_running, account)) {
 		gc->wants_to_die = TRUE;
-		purple_connection_error(gc, _("Cannot initialize SILC protocol"));
+		purple_connection_error_reason(gc, PURPLE_REASON_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, _("Error loading SILC key pair"));
+		purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR,
+		                             _("Error loading SILC key pair"));
 		return;
 	}
 
============================================================
--- libpurple/protocols/silc/util.c	dc180615f15f1f5b3128810202d21d5a06061a7b
+++ libpurple/protocols/silc/util.c	59ef50b5eae7e4de46d5e69bd3d2ae5aca8106e9
@@ -212,7 +212,8 @@ gboolean silcpurple_check_silc_dir(Purpl
 						  (gc->password == NULL)
 						  ? "" : gc->password,
 						  NULL, NULL, FALSE)) {
-				purple_connection_error(gc, _("Cannot create SILC key pair\n"));
+				purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR,
+				                             _("Cannot create SILC key pair\n"));
 				return FALSE;
 			}
 
@@ -254,7 +255,8 @@ gboolean silcpurple_check_silc_dir(Purpl
 						  (gc->password == NULL)
 						  ? "" : gc->password,
 						  NULL, NULL, FALSE)) {
-				purple_connection_error(gc, _("Cannot create SILC key pair\n"));
+				purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR,
+				                             _("Cannot create SILC key pair\n"));
 				return FALSE;
 			}
 


More information about the Commits mailing list