im.pidgin.cpw.resiak.disconnectreason: 2dfc63b8249646c36564f7a4ef9bca3fc2ada84c

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


revision:            2dfc63b8249646c36564f7a4ef9bca3fc2ada84c
date:                2007-10-01T14:54:31
author:              resiak at soc.pidgin.im
branch:              im.pidgin.cpw.resiak.disconnectreason
changelog:
Add disconnect reasons to novell.

manifest:
format_version "1"

new_manifest [5cecc8a08754b80f8699e5220dd47f38c5a96d30]

old_revision [ce31027fc6df8a7d7f7376fc14b74e5b86d6d885]

patch "libpurple/protocols/novell/novell.c"
 from [3961c5977fa6faf1d28df07f87a8e97ec188127b]
   to [67e02bcf1f47222d15d3f01c82d726ad15ae2608]
-------------- next part --------------
#
#
# patch "libpurple/protocols/novell/novell.c"
#  from [3961c5977fa6faf1d28df07f87a8e97ec188127b]
#    to [67e02bcf1f47222d15d3f01c82d726ad15ae2608]
#
============================================================
--- libpurple/protocols/novell/novell.c	3961c5977fa6faf1d28df07f87a8e97ec188127b
+++ libpurple/protocols/novell/novell.c	67e02bcf1f47222d15d3f01c82d726ad15ae2608
@@ -120,19 +120,26 @@ _login_resp_cb(NMUser * user, NMERR_T re
 		_check_for_disconnect(user, rc);
 
 	} else {
-
+		PurpleDisconnectReason reason;
 		char *err = g_strdup_printf(_("Login failed (%s)."),
 					    nm_error_to_string (ret_code));
 
-		/* Don't attempt to auto-reconnect if our password
-		 * was invalid.
-		 */
-		if (ret_code == NMERR_AUTHENTICATION_FAILED ||
-			ret_code == NMERR_CREDENTIALS_MISSING ||
-			ret_code == NMERR_PASSWORD_INVALID) {
-			gc->wants_to_die = TRUE;
+		switch (ret_code) {
+			case NMERR_AUTHENTICATION_FAILED:
+			case NMERR_CREDENTIALS_MISSING:
+			case NMERR_PASSWORD_INVALID:
+				/* Don't attempt to auto-reconnect if our
+				 * password was invalid.
+				 */
+				gc->wants_to_die = TRUE;
+				reason = PURPLE_REASON_AUTHENTICATION_FAILED;
+				break;
+			default:
+				/* FIXME: There are other reasons login could fail */
+				reason = PURPLE_REASON_NETWORK_ERROR;
 		}
-		purple_connection_error(gc, err);
+
+		purple_connection_error_reason (gc, reason, err);
 		g_free(err);
 	}
 }
@@ -1118,8 +1125,8 @@ _check_for_disconnect(NMUser * user, NME
 
 	if (_is_disconnect_error(err)) {
 
-		purple_connection_error(gc, _("Error communicating with server."
-									" Closing connection."));
+		purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Error communicating with server. Closing connection."));
 		return TRUE;
 
 	}
@@ -1665,7 +1672,7 @@ novell_ssl_connect_error(PurpleSslConnec
 	user = gc->proto_data;
 	user->conn->ssl_conn->data = NULL;
 
-	purple_connection_error(gc, _("Unable to make SSL connection to server."));
+	purple_connection_ssl_error (gc, error);
 }
 
 static void
@@ -1688,9 +1695,9 @@ novell_ssl_recv_cb(gpointer data, Purple
 
 		if (_is_disconnect_error(rc)) {
 
-			purple_connection_error(gc,
-								  _("Error communicating with server."
-									" Closing connection."));
+			purple_connection_error_reason (gc,
+				PURPLE_REASON_NETWORK_ERROR,
+				_("Error communicating with server. Closing connection."));
 		} else {
 			purple_debug(PURPLE_DEBUG_INFO, "novell",
 					   "Error processing event or response (%d).\n", rc);
@@ -1729,7 +1736,8 @@ novell_ssl_connected_cb(gpointer data, P
 		conn->connected = TRUE;
 		purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc);
 	} else {
-		purple_connection_error(gc, _("Unable to connect to server."));
+		purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Unable to connect to server."));
 	}
 
 	purple_connection_update_progress(gc, _("Waiting for response..."),
@@ -2009,7 +2017,8 @@ _evt_user_disconnect(NMUser * user, NMEv
 	if (gc)
 	{
 		gc->wants_to_die = TRUE; /* we don't want to reconnect in this case */
-		purple_connection_error(gc, _("You have been logged out because you"
+		purple_connection_error_reason (gc, PURPLE_REASON_NAME_IN_USE,
+									_("You have been logged out because you"
 									" logged in at another workstation."));
 	}
 }
@@ -2164,9 +2173,9 @@ novell_login(PurpleAccount * account)
 		 */
 
 		/* ...but for now just error out with a nice message. */
-		purple_connection_error(gc, _("Unable to connect to server."
-									" Please enter the address of the server"
-									" you wish to connect to."));
+		purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR,
+			_("Unable to connect to server. Please enter the "
+			  "address of the server you wish to connect to."));
 		return;
 	}
 
@@ -2192,8 +2201,9 @@ novell_login(PurpleAccount * account)
 													  user->conn->addr, user->conn->port,
 													  novell_ssl_connected_cb, novell_ssl_connect_error, gc);
 		if (user->conn->ssl_conn->data == NULL) {
-			purple_connection_error(gc, _("Error."
-										" SSL support is not installed."));
+			purple_connection_error_reason (gc,
+				PURPLE_REASON_ENCRYPTION_ERROR,
+				_("Error. SSL support is not installed."));
 		}
 	}
 }


More information about the Commits mailing list