changeset 21395:04b1742c8206

Restore error notifications on the buddy list after a restart. Make the Ignore button on the signed in elsewhere notification clear the accounts' current errors so that they aren't around to be restored after restarts. References #168
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 03 Nov 2007 11:05:52 +0000
parents ff5cd00e4f14
children 78f8a19785b1
files pidgin/gtkblist.c
diffstat 1 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sat Nov 03 00:25:33 2007 +0000
+++ b/pidgin/gtkblist.c	Sat Nov 03 11:05:52 2007 +0000
@@ -4498,6 +4498,12 @@
 ignore_elsewhere_accounts(PidginBuddyList *gtkblist)
 {
 	PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
+	GList *l;
+
+	for (l = priv->accounts_signed_on_elsewhere; l != NULL; l = l->next) {
+		PurpleAccount *account = l->data;
+		purple_account_clear_current_error(account);
+	}
 
 	g_list_free(priv->accounts_signed_on_elsewhere);
 	priv->accounts_signed_on_elsewhere = NULL;
@@ -4687,8 +4693,8 @@
 	update_signed_on_elsewhere_minidialog_title();
 }
 
+
 /* Call appropriate error notification code based on error types */
-
 static void
 update_account_error_state(PurpleAccount *account,
                            const PurpleConnectionErrorInfo *old,
@@ -4716,6 +4722,26 @@
 	}
 }
 
+/* In case accounts are loaded before the blist (which they currently are),
+ * let's call update_account_error_state ourselves on every account's current
+ * state when the blist starts.
+ */
+static void
+show_initial_account_errors(PidginBuddyList *gtkblist)
+{
+	GList *l = purple_accounts_get_all();
+	PurpleAccount *account;
+	const PurpleConnectionErrorInfo *err;
+
+	for (; l; l = l->next)
+	{
+		account = l->data;
+		err = purple_account_get_current_error(account);
+
+		update_account_error_state(account, NULL, err, gtkblist);
+	}
+}
+
 void
 pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text)
 {
@@ -5302,6 +5328,8 @@
 	gtk_widget_hide(gtkblist->headline_hbox);
 	gtk_widget_hide(gtkblist->error_buttons);
 
+	show_initial_account_errors(gtkblist);
+
 	/* emit our created signal */
 	handle = pidgin_blist_get_handle();
 	purple_signal_emit(handle, "gtkblist-created", list);