im.pidgin.cpw.resiak.disconnectreason: 7266acdcb410efd87541ac9165bc9c877b871565

resiak at soc.pidgin.im resiak at soc.pidgin.im
Wed Oct 3 13:57:05 EDT 2007


revision:            7266acdcb410efd87541ac9165bc9c877b871565
date:                2007-10-01T16:07:14
author:              resiak at soc.pidgin.im
branch:              im.pidgin.cpw.resiak.disconnectreason
changelog:
Add disconnection reasons to oscar.

manifest:
format_version "1"

new_manifest [c13468cc486782c497fd832d3669820743ba35a8]

old_revision [2dfc63b8249646c36564f7a4ef9bca3fc2ada84c]

patch "libpurple/protocols/oscar/flap_connection.c"
 from [ce63aedf0f9cb4ad475341c080c45dc5939fd1d6]
   to [93f5a5ac0b5c5f4c8bde5a746e68f4228838e55f]

patch "libpurple/protocols/oscar/oscar.c"
 from [e8ca0d3642afad77623f819ccfb2e950684980a7]
   to [0c578e7d830b57ff38c81abd6c7e8d7a7bb6629d]
-------------- next part --------------
#
#
# patch "libpurple/protocols/oscar/flap_connection.c"
#  from [ce63aedf0f9cb4ad475341c080c45dc5939fd1d6]
#    to [93f5a5ac0b5c5f4c8bde5a746e68f4228838e55f]
# 
# patch "libpurple/protocols/oscar/oscar.c"
#  from [e8ca0d3642afad77623f819ccfb2e950684980a7]
#    to [0c578e7d830b57ff38c81abd6c7e8d7a7bb6629d]
#
============================================================
--- libpurple/protocols/oscar/flap_connection.c	ce63aedf0f9cb4ad475341c080c45dc5939fd1d6
+++ libpurple/protocols/oscar/flap_connection.c	93f5a5ac0b5c5f4c8bde5a746e68f4228838e55f
@@ -380,7 +380,10 @@ flap_connection_destroy_cb(gpointer data
 	{
 		/* No more FLAP connections!  Sign off this PurpleConnection! */
 		gchar *tmp;
+		PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR;
+
 		if (conn->disconnect_code == 0x0001) {
+			reason = PURPLE_REASON_NAME_IN_USE;
 			tmp = g_strdup(_("You have signed on from another location."));
 			od->gc->wants_to_die = TRUE;
 		} else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED)
@@ -402,7 +405,7 @@ flap_connection_destroy_cb(gpointer data
 
 		if (tmp != NULL)
 		{
-			purple_connection_error(od->gc, tmp);
+			purple_connection_error_reason(od->gc, reason, tmp);
 			g_free(tmp);
 		}
 	}
============================================================
--- libpurple/protocols/oscar/oscar.c	e8ca0d3642afad77623f819ccfb2e950684980a7
+++ libpurple/protocols/oscar/oscar.c	0c578e7d830b57ff38c81abd6c7e8d7a7bb6629d
@@ -993,7 +993,7 @@ connection_established_cb(gpointer data,
 			gchar *msg;
 			msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"),
 					error_message);
-			purple_connection_error(gc, msg);
+			purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg);
 			g_free(msg);
 		}
 		else if (conn->type == SNAC_FAMILY_LOCATE)
@@ -1001,7 +1001,7 @@ connection_established_cb(gpointer data,
 			gchar *msg;
 			msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"),
 					error_message);
-			purple_connection_error(gc, msg);
+			purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg);
 			g_free(msg);
 		}
 		else
@@ -1257,7 +1257,7 @@ oscar_login(PurpleAccount *account)
 		gchar *buf;
 		buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid.  Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account));
 		gc->wants_to_die = TRUE;
-		purple_connection_error(gc, buf);
+		purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, buf);
 		g_free(buf);
 	}
 
@@ -1278,7 +1278,8 @@ oscar_login(PurpleAccount *account)
 			connection_established_cb, newconn);
 	if (newconn->connect_data == NULL)
 	{
-		purple_connection_error(gc, _("Couldn't connect to host"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+				_("Couldn't connect to host"));
 		return;
 	}
 
@@ -1340,42 +1341,42 @@ purple_parse_auth_resp(OscarData *od, Fl
 		case 0x01:
 			/* Unregistered screen name */
 			gc->wants_to_die = TRUE;
-			purple_connection_error(gc, _("Invalid screen name."));
+			purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Invalid screen name."));
 			break;
 		case 0x05:
 			/* Incorrect password */
 			gc->wants_to_die = TRUE;
 			if (!purple_account_get_remember_password(account))
 				purple_account_set_password(account, NULL);
-			purple_connection_error(gc, _("Incorrect password."));
+			purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Incorrect password."));
 			break;
 		case 0x11:
 			/* Suspended account */
 			gc->wants_to_die = TRUE;
-			purple_connection_error(gc, _("Your account is currently suspended."));
+			purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Your account is currently suspended."));
 			break;
 		case 0x14:
 			/* service temporarily unavailable */
-			purple_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable."));
+			purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable."));
 			break;
 		case 0x18:
 			/* screen name connecting too frequently */
 			gc->wants_to_die = TRUE;
-			purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
+			purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
 			break;
 		case 0x1c:
 			/* client too old */
 			gc->wants_to_die = TRUE;
 			g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE);
-			purple_connection_error(gc, buf);
+			purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, buf);
 			break;
 		case 0x1d:
 			/* IP address connecting too frequently */
 			gc->wants_to_die = TRUE;
-			purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
+			purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
 			break;
 		default:
-			purple_connection_error(gc, _("Authentication failed"));
+			purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Authentication failed"));
 			break;
 		}
 		purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode);
@@ -1405,7 +1406,7 @@ purple_parse_auth_resp(OscarData *od, Fl
 	g_free(host);
 	if (newconn->connect_data == NULL)
 	{
-		purple_connection_error(gc, _("Could Not Connect"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Could Not Connect"));
 		return 0;
 	}
 
@@ -1431,7 +1432,8 @@ purple_parse_auth_securid_request_no_cb(
 
 	/* Disconnect */
 	gc->wants_to_die = TRUE;
-	purple_connection_error(gc, _("The SecurID key entered is invalid."));
+	purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED,
+		_("The SecurID key entered is invalid."));
 }
 
 static int


More information about the Commits mailing list