changeset 9961:ff704c905239

[gaim-migrate @ 10869] The autoreconnection plugin should not be responsible for setting initial status for your accounts. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 07 Sep 2004 05:15:38 +0000
parents faf9ccf3e0d5
children 499a71d5d20f
files plugins/autorecon.c
diffstat 1 files changed, 1 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/autorecon.c	Tue Sep 07 02:36:09 2004 +0000
+++ b/plugins/autorecon.c	Tue Sep 07 05:15:38 2004 +0000
@@ -18,26 +18,13 @@
 	guint timeout;
 } GaimAutoRecon;
 
-/*
-   I use a struct here, but the visible/invisible isn't yet supported
-   in this plugin, so this is more for future implementation of those
-   features
-*/
-typedef struct {
-	const char *state;
-	const char *message;
-} GaimAwayState;
-
 static GHashTable *hash = NULL;
-static GHashTable *awayStates = NULL;
-
 
 #define AUTORECON_OPT  "/plugins/core/autorecon"
 #define OPT_HIDE_CONNECTED   AUTORECON_OPT "/hide_connected_error"
 #define OPT_HIDE_CONNECTING  AUTORECON_OPT "/hide_connecting_error"
 #define OPT_RESTORE_STATE    AUTORECON_OPT "/restore_state"
 
-
 /* storage of original (old_ops) and modified (new_ops) ui ops to allow us to
    intercept calls to report_disconnect */
 static GaimConnectionUiOps *old_ops = NULL;
@@ -116,37 +103,6 @@
 	} else if (info != NULL) {
 		g_hash_table_remove(hash, account);
 	}
-
-	if (gc->wants_to_die) 
-		g_hash_table_remove(awayStates, account);
-}
-
-static void save_state(GaimAccount *account, const char *state, const char *message) {
-	/* Saves whether the account is back/away/visible/invisible */
-
-	GaimAwayState *info;
-
-	if (!strcmp(state,GAIM_AWAY_CUSTOM)) {
-		info = g_new0(GaimAwayState, 1);
-		info->state = state;
-		info->message = message;
-
-		g_hash_table_insert(awayStates, account, info);
-	} else if(!strcmp(state,"Back")) 
-		g_hash_table_remove(awayStates, account);
-}
-
-static void restore_state(GaimConnection *gc, void *m) {
-	/* Restore the state to what it was before the disconnect */
-	GaimAwayState *info;
-	GaimAccount *account;
-
-	g_return_if_fail(gc != NULL && gaim_prefs_get_bool(OPT_RESTORE_STATE));
-	account = gaim_connection_get_account(gc);
-
-	info = g_hash_table_lookup(awayStates, account);
-	if (info)
-		serv_set_away(gc, info->state, info->message);
 }
 
 static void
@@ -185,18 +141,9 @@
 	hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
 			free_auto_recon);
 
-	awayStates = g_hash_table_new(g_int_hash, g_int_equal);
-
 	gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
 			plugin, GAIM_CALLBACK(reconnect), NULL);
 
-	gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
-			plugin, GAIM_CALLBACK(restore_state), NULL);
-
-	gaim_signal_connect(gaim_accounts_get_handle(), "account-away",
-			plugin, GAIM_CALLBACK(save_state), NULL);
-
-
 	return TRUE;
 }
 
@@ -207,18 +154,9 @@
 	gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
 			plugin, GAIM_CALLBACK(reconnect));
 
-	gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
-			plugin, GAIM_CALLBACK(restore_state));
-	
-	gaim_signal_disconnect(gaim_accounts_get_handle(), "account-away",
-			plugin, GAIM_CALLBACK(save_state));
-
 	g_hash_table_destroy(hash);
 	hash = NULL;
 
-	g_hash_table_destroy(awayStates);
-	awayStates = NULL;
-
 	gaim_connections_set_ui_ops(old_ops);
 	g_free(new_ops);
 	old_ops = new_ops = NULL;
@@ -242,10 +180,6 @@
 		_("Hide Login Errors"));
 	gaim_plugin_pref_frame_add(frame, pref);
 
-	pref = gaim_plugin_pref_new_with_name_and_label(OPT_RESTORE_STATE,
-		_("Restore Away State On Reconnect"));
-	gaim_plugin_pref_frame_add(frame, pref);
-
 	return frame;
 }
 
@@ -293,7 +227,7 @@
 	gaim_prefs_add_none(AUTORECON_OPT);
 	gaim_prefs_add_bool(OPT_HIDE_CONNECTED, FALSE);
 	gaim_prefs_add_bool(OPT_HIDE_CONNECTING, FALSE);
-	gaim_prefs_add_bool(OPT_RESTORE_STATE, TRUE);
+	gaim_prefs_remove_bool(OPT_RESTORE_STATE);
 }
 
 GAIM_INIT_PLUGIN(autorecon, init_plugin, info)