static gboolean gaim_connection_disconnect_cb(gpointer data) { GaimAccount *account = data; char *password = g_strdup(gaim_account_get_password(account)); gaim_account_disconnect(account); gaim_account_set_password(account, password); g_free(password); return FALSE; }
void gaim_connections_disconnect_all(void) { GList *l; GaimConnection *gc; while ((l = gaim_connections_get_all()) != NULL) { gc = l->data; gc->wants_to_die = TRUE; gaim_account_disconnect(gc->account); } }
void gaim_connection_disconnect(GaimConnection *gc) { GaimAccount *account; GList *wins; g_return_if_fail(gc != NULL); account = gaim_connection_get_account(gc); if (gaim_account_get_connection(account) != NULL) { gaim_account_disconnect(account); return; } gaim_debug(GAIM_DEBUG_INFO, "connection", "Disconnecting connection %p\n", gc); if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) { if (gaim_connection_get_state(gc) != GAIM_CONNECTING) gaim_blist_remove_account(gaim_connection_get_account(gc)); gaim_signal_emit(gaim_connections_get_handle(), "signing-off", gc); serv_close(gc); connections = g_list_remove(connections, gc); gaim_connection_set_state(gc, GAIM_DISCONNECTED); gaim_signal_emit(gaim_connections_get_handle(), "signed-off", gc); system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); /* * XXX This is a hack! Remove this and replace it with a better event * notification system. */ for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) { GaimWindow *win = (GaimWindow *)wins->data; gaim_conversation_update(gaim_window_get_conversation_at(win, 0), GAIM_CONV_ACCOUNT_OFFLINE); } gaim_request_close_with_handle(gc); gaim_notify_close_with_handle(gc); } gaim_connection_destroy(gc); }