Mercurial > pidgin.yaz
changeset 9930:45a49b01dc03
[gaim-migrate @ 10822]
i didn't mean to commit this
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 01 Sep 2004 02:03:09 +0000 |
parents | 24550263874d |
children | 7101987a49c8 |
files | plugins/autorecon.c |
diffstat | 1 files changed, 4 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/autorecon.c Wed Sep 01 01:34:47 2004 +0000 +++ b/plugins/autorecon.c Wed Sep 01 02:03:09 2004 +0000 @@ -29,13 +29,12 @@ static GHashTable *hash = NULL; static GHashTable *awayStates = NULL; -static GSList *accountReconnecting = 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" -#define OPT_HIDE_RECONNECTING_DIALOG AUTORECON_OPT "/hide_reconnecting_dialog" +#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 @@ -43,69 +42,6 @@ static GaimConnectionUiOps *old_ops = NULL; static GaimConnectionUiOps *new_ops = NULL; -static void connect_progress(GaimConnection *gc, const char *text, - size_t step, size_t step_count) { - if(old_ops == NULL || old_ops->connect_progress == NULL) { - /* there's nothing to call through to, so don't bother - checking prefs */ - return; - } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && - g_slist_find(accountReconnecting, gc->account)) { - /* this is a reconnecting, and we're hiding those */ - gaim_debug(GAIM_DEBUG_INFO, "autorecon", - "hide connecting dialog while reconnecting\n"); - return; - } - - old_ops->connect_progress(gc, text, step, step_count); -} - -static void connected(GaimConnection *gc) { - if(old_ops == NULL || old_ops->connected == NULL) { - /* there's nothing to call through to, so don't bother - checking prefs */ - return; - } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && - g_slist_find(accountReconnecting, gc->account)) { - /* this is a reconnecting, and we're hiding those */ - gaim_debug(GAIM_DEBUG_INFO, "autorecon", - "hide connecting dialog while reconnecting\n"); - return; - } - - old_ops->connected(gc); -} - -static void disconnected(GaimConnection *gc) { - if(old_ops == NULL || old_ops->disconnected == NULL) { - /* there's nothing to call through to, so don't bother - checking prefs */ - return; - } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && - g_slist_find(accountReconnecting, gc->account)) { - /* this is a reconnecting, and we're hiding those */ - gaim_debug(GAIM_DEBUG_INFO, "autorecon", - "hide connecting dialog while reconnecting\n"); - return; - } - - old_ops->disconnected(gc); -} - -static void notice(GaimConnection *gc, const char *text) { - if(old_ops == NULL || old_ops->notice == NULL) { - /* there's nothing to call through to, so don't bother - checking prefs */ - return; - } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && - g_slist_find(accountReconnecting, gc->account)) { - /* this is a reconnecting, and we're hiding those */ - gaim_debug(GAIM_DEBUG_INFO, "autorecon", - "hide connecting dialog while reconnecting\n"); - } - - old_ops->notice(gc, text); -} static void report_disconnect(GaimConnection *gc, const char *text) { @@ -160,15 +96,10 @@ static void reconnect(GaimConnection *gc, void *m) { GaimAccount *account; GaimAutoRecon *info; - GSList* listAccount; g_return_if_fail(gc != NULL); account = gaim_connection_get_account(gc); info = g_hash_table_lookup(hash, account); - if (accountReconnecting) - listAccount = g_slist_find(accountReconnecting, account); - else - listAccount = NULL; if (!gc->wants_to_die) { if (info == NULL) { @@ -181,14 +112,8 @@ g_source_remove(info->timeout); } info->timeout = g_timeout_add(info->delay, do_signon, account); - - if (!listAccount) - accountReconnecting = g_slist_prepend(accountReconnecting, account); } else if (info != NULL) { g_hash_table_remove(hash, account); - - if (listAccount) - accountReconnecting = g_slist_delete_link(accountReconnecting, listAccount); } if (gc->wants_to_die) @@ -221,9 +146,6 @@ info = g_hash_table_lookup(awayStates, account); if (info) serv_set_away(gc, info->state, info->message); - - if (accountReconnecting) - accountReconnecting = g_slist_remove(accountReconnecting, account); } static void @@ -256,10 +178,6 @@ old_ops = gaim_connections_get_ui_ops(); new_ops = (GaimConnectionUiOps *) g_memdup(old_ops, sizeof(GaimConnectionUiOps)); - new_ops->connect_progress = connect_progress; - new_ops->connected = connected; - new_ops->disconnected = disconnected; - new_ops->notice = notice; new_ops->report_disconnect = report_disconnect; gaim_connections_set_ui_ops(new_ops); @@ -267,8 +185,6 @@ free_auto_recon); awayStates = g_hash_table_new(g_int_hash, g_int_equal); - - accountReconnecting = NULL; gaim_signal_connect(gaim_connections_get_handle(), "signed-off", plugin, GAIM_CALLBACK(reconnect), NULL); @@ -301,11 +217,6 @@ g_hash_table_destroy(awayStates); awayStates = NULL; - - if (accountReconnecting) { - g_slist_free(accountReconnecting); - accountReconnecting = NULL; - } gaim_connections_set_ui_ops(old_ops); g_free(new_ops); @@ -334,10 +245,6 @@ _("Restore Away State On Reconnect")); gaim_plugin_pref_frame_add(frame, pref); - pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_RECONNECTING_DIALOG, - _("Hide Reconnecting Dialog")); - gaim_plugin_pref_frame_add(frame, pref); - return frame; } @@ -384,7 +291,6 @@ 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_add_bool(OPT_HIDE_RECONNECTING_DIALOG, FALSE); } GAIM_INIT_PLUGIN(autorecon, init_plugin, info)