im.pidgin.cpw.resiak.disconnectreason: 5dcaadc25abb777342bcec5f2438c4ac5aa4c527

resiak at soc.pidgin.im resiak at soc.pidgin.im
Wed Oct 31 11:40:54 EDT 2007


-----------------------------------------------------------------
Revision: 5dcaadc25abb777342bcec5f2438c4ac5aa4c527
Ancestor: 3d34104c329f20bd5369a2c6fb943c7bbef6fc4a
Author: resiak at soc.pidgin.im
Date: 2007-10-31T15:32:24
Branch: im.pidgin.cpw.resiak.disconnectreason

Modified files:
        pidgin/gtkconn.c

ChangeLog: 

Don't pop up a separate error dialog when an account is disconnected by
NAME_IN_USE.

-------------- next part --------------
============================================================
--- pidgin/gtkconn.c	93569dffe21bfeb2fef63bfe1bc635d547d533f1
+++ pidgin/gtkconn.c	c4ce035ad4d46c129fcf9fb770f73b2b01fe4cbe
@@ -136,6 +136,43 @@ static void
 }
 
 static void
+notify_account_disabled(PurpleAccount *account,
+                        PurpleConnectionError reason,
+                        const char *text)
+{
+	const char *username = purple_account_get_username(account);
+	const char *alias = purple_account_get_alias(account);
+	const char *protocol = purple_account_get_protocol_name(account);
+	char *p, *s, *n;
+
+	if (alias)
+		n = g_strdup_printf("%s (%s) (%s)", username, alias, protocol);
+	else
+		n = g_strdup_printf("%s (%s)", username, protocol);
+
+	p = g_strdup_printf(_("%s disconnected"), n);
+
+	if(reason == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT)
+		s = g_strdup_printf(
+			_("%s\n\n"
+			"%s will not attempt to reconnect the account until you "
+			"re-enable the account.  See %s for information on how to "
+			"compile %s with SSL support."), text, PIDGIN_NAME,
+			"http://developer.pidgin.im/wiki/FAQssl", PIDGIN_NAME);
+	else
+		s = g_strdup_printf(
+			_("%s\n\n"
+			"%s will not attempt to reconnect the account until you "
+			"correct the error and re-enable the account."), text,
+			PIDGIN_NAME);
+
+	purple_notify_error(NULL, NULL, p, s);
+	g_free(p);
+	g_free(s);
+	g_free(n);
+}
+
+static void
 pidgin_connection_report_disconnect_reason (PurpleConnection *gc,
                                             PurpleConnectionError reason,
                                             const char *text)
@@ -159,53 +196,12 @@ pidgin_connection_report_disconnect_reas
 		}
 		info->timeout = g_timeout_add(info->delay, do_signon, account);
 	} else {
-		char *p, *s, *n=NULL ;
 		if (info != NULL)
 			g_hash_table_remove(auto_reconns, account);
 
-		if (purple_account_get_alias(account))
-		{
-			n = g_strdup_printf("%s (%s) (%s)",
-					purple_account_get_username(account),
-					purple_account_get_alias(account),
-					purple_account_get_protocol_name(account));
-		}
-		else
-		{
-			n = g_strdup_printf("%s (%s)",
-					purple_account_get_username(account),
-					purple_account_get_protocol_name(account));
-		}
+		if (reason != PURPLE_CONNECTION_ERROR_NAME_IN_USE)
+			notify_account_disabled(account, reason, text);
 
-		p = g_strdup_printf(_("%s disconnected"), n);
-		switch (reason)
-		{
-			case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT:
-				s = g_strdup_printf(
-					_("%s\n\n"
-					"%s will not attempt to reconnect the account until you "
-					"re-enable the account.  See %s for information on how to "
-					"compile %s with SSL support."), text, PIDGIN_NAME,
-					"http://developer.pidgin.im/wiki/FAQssl", PIDGIN_NAME);
-				break;
-			case PURPLE_CONNECTION_ERROR_NAME_IN_USE:
-				s = g_strdup_printf(
-					_("%s\n\n"
-					"%s will not attempt to reconnect the account until you "
-					"re-enable it."), text, PIDGIN_NAME);
-				break;
-			default:
-				s = g_strdup_printf(
-					_("%s\n\n"
-					"%s will not attempt to reconnect the account until you "
-					"correct the error and re-enable the account."), text,
-					PIDGIN_NAME);
-		}
-		purple_notify_error(NULL, NULL, p, s);
-		g_free(p);
-		g_free(s);
-		g_free(n);
-
 		/*
 		 * TODO: Do we really want to disable the account when it's
 		 * disconnected by wants_to_die?  This happens when you sign


More information about the Commits mailing list