diff libpurple/connection.c @ 20813:66e7b104b4ea

rlaager pointed out that purple_connection_error_reason should be setting wants_to_die appropriately to the reason, rather than leaving it up to the prpl, so let's make it so!
author Will Thompson <will.thompson@collabora.co.uk>
date Tue, 09 Oct 2007 13:25:47 +0000
parents 682543aced31
children 38d7c849d444
line wrap: on
line diff
--- a/libpurple/connection.c	Sun Oct 07 10:28:32 2007 +0000
+++ b/libpurple/connection.c	Tue Oct 09 13:25:47 2007 +0000
@@ -488,7 +488,10 @@
 void
 purple_connection_error(PurpleConnection *gc, const char *text)
 {
-	purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, text);
+	PurpleDisconnectReason reason = gc->wants_to_die
+	                              ? PURPLE_REASON_OTHER_ERROR
+	                              : PURPLE_REASON_NETWORK_ERROR;
+	purple_connection_error_reason (gc, reason, text);
 }
 
 void
@@ -497,28 +500,21 @@
                                 const char *description)
 {
 	PurpleConnectionUiOps *ops;
-	gboolean fatal;
 
 	g_return_if_fail(gc   != NULL);
+	g_assert (reason < PURPLE_NUM_REASONS);
 
 	if (description == NULL) {
 		purple_debug_error("connection", "purple_connection_error_reason: check `description != NULL' failed\n");
 		description = _("Unknown error");
 	}
 
-	g_assert (reason < PURPLE_NUM_REASONS);
-
-	/* This should probably be removed at some point */
-	fatal = purple_connection_reason_is_fatal (reason);
-	if (fatal != gc->wants_to_die)
-		purple_debug_warning ("connection",
-			"reason %u is %sfatal but wants_to_die is %u",
-			reason, (fatal ? "" : "not "), gc->wants_to_die);
-
 	/* If we've already got one error, we don't need any more */
 	if (gc->disconnect_timeout)
 		return;
 
+	gc->wants_to_die = purple_connection_reason_is_fatal (reason);
+
 	ops = purple_connections_get_ui_ops();
 
 	if (ops != NULL)