Ejemplo n.º 1
0
/**
 * Logoff and deallocate a session.
 *
 * @param od Session to kill
 */
void
oscar_data_destroy(OscarData *od)
{
	aim_cleansnacs(od, -1);

	while (od->requesticon)
	{
		gchar *sn = od->requesticon->data;
		od->requesticon = g_slist_remove(od->requesticon, sn);
		g_free(sn);
	}
	g_free(od->email);
	g_free(od->newp);
	g_free(od->oldp);
	if (od->icontimer > 0)
		gaim_timeout_remove(od->icontimer);
	if (od->getblisttimer > 0)
		gaim_timeout_remove(od->getblisttimer);
	if (od->getinfotimer > 0)
		gaim_timeout_remove(od->getinfotimer);
	while (od->oscar_connections != NULL)
		flap_connection_destroy(od->oscar_connections->data,
				OSCAR_DISCONNECT_DONE, NULL);

	while (od->peer_connections != NULL)
		peer_connection_destroy(od->peer_connections->data,
				OSCAR_DISCONNECT_LOCAL_CLOSED, NULL);

	aim__shutdownmodules(od);

	g_hash_table_destroy(od->buddyinfo);
	g_hash_table_destroy(od->handlerlist);

	g_free(od);
}
Ejemplo n.º 2
0
static void gaym_close(GaimConnection * gc)
{
    struct gaym_conn *gaym = gc->proto_data;

    gaim_debug_misc("gaym", "gaym close function has been called\n");
    if (gaym == NULL)
        return;

    gaym_cmd_quit(gaym, "quit", NULL, NULL);

    if (gc->inpa)
        gaim_input_remove(gc->inpa);

    g_free(gaym->inbuf);
    gaim_debug_misc("gaym", "closing fd %i\n", gaym->fd);
    close(gaym->fd);

    if (gaym->timer)
        gaim_timeout_remove(gaym->timer);

    if (gaym->thumbnail)
        g_free(gaym->thumbnail);

    if (gaym->chat_key)
        g_free(gaym->chat_key);

    if (gaym->server_bioline)
        g_free(gaym->server_bioline);

    if (gaym->server_stats)
        g_free(gaym->server_stats);

    if (gaym->roomlist_filter)
        g_free(gaym->roomlist_filter);

    if (gaym->bio)
        g_free(gaym->bio);

    g_hash_table_destroy(gaym->cmds);
    g_hash_table_destroy(gaym->msgs);
    g_hash_table_destroy(gaym->info_window_needed);
    g_hash_table_destroy(gaym->entry_order);
    if (gaym->motd)
        g_string_free(gaym->motd, TRUE);

    if (gaym->names)
        g_string_free(gaym->names, TRUE);

    if (gaym->nameconv)
        g_free(gaym->nameconv);
    if (gaym->subroom)
        g_free(gaym->subroom);

    g_hash_table_destroy(gaym->confighash);

    g_hash_table_foreach(gaym->hammers, (GHFunc)kill_hammer, NULL);

    g_free(gaym->server);
    g_free(gaym);
}
Ejemplo n.º 3
0
static int halt_flash_filter(GtkWidget *widget, GdkEventFocus *event, gpointer data) {
        if(MyFlashWindowEx) {
                HWND hWnd = data;
                FLASHWINFO info;

                if(!IsWindow(hWnd))
                        return 0;
                memset(&info, 0, sizeof(FLASHWINFO));
		info.cbSize = sizeof(FLASHWINFO);
		info.hwnd = hWnd;
		info.dwFlags = FLASHW_STOP;
		info.dwTimeout = 0;
		MyFlashWindowEx(&info);
        }
        else {
                WGAIM_FLASH_INFO *finfo = data;        
                /* Stop flashing and remove filter */
                gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Removing timeout\n");
                gaim_timeout_remove(finfo->t_handle);
                gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Disconnecting signal handler\n");
                g_signal_handler_disconnect(G_OBJECT(widget),finfo->sig_handler);
                gaim_debug(GAIM_DEBUG_INFO, "wgaim", "done\n");
                g_free(finfo);
        }
	return 0;
}
Ejemplo n.º 4
0
Archivo: irc.c Proyecto: VoxOx/VoxOx
static void irc_close(GaimConnection *gc)
{
	struct irc_conn *irc = gc->proto_data;

	if (irc == NULL)
		return;

	if (irc->gsc || (irc->fd >= 0))
		irc_cmd_quit(irc, "quit", NULL, NULL);

	if (gc->inpa)
		gaim_input_remove(gc->inpa);

	g_free(irc->inbuf);
	if (irc->gsc) {
		gaim_ssl_close(irc->gsc);
	} else if (irc->fd >= 0) {
		close(irc->fd);
	}
	if (irc->timer)
		gaim_timeout_remove(irc->timer);
	g_hash_table_destroy(irc->cmds);
	g_hash_table_destroy(irc->msgs);
	g_hash_table_destroy(irc->buddies);
	if (irc->motd)
		g_string_free(irc->motd, TRUE);
	g_free(irc->server);

	if (irc->writeh)
		gaim_input_remove(irc->writeh);

	gaim_circ_buffer_destroy(irc->outbuf);

	g_free(irc);
}
Ejemplo n.º 5
0
gboolean gaym_blist_timeout(struct gaym_conn * gaym)
{
    /**
     * There are 510 characters available for an IRC command (512 if
     * you count CR-LF).  "WHOIS " takes up 6 characters.  Assuming
     * you need allow an extra character for the NULL when using
     * g_string_sized_new(), we need to allocate (510-6)+1=505 here.
     */
    BListWhois *blist_whois = g_new0(BListWhois, 1);
    blist_whois->count = 0;
    blist_whois->string = g_string_sized_new(505);

    char *list, *buf;

    g_hash_table_foreach(gaym->buddies, (GHFunc) gaym_buddy_append,
                         (gpointer) blist_whois);

    list = g_string_free(blist_whois->string, FALSE);
    if (!list || !strlen(list)) {
        g_hash_table_foreach(gaym->buddies, (GHFunc) gaym_buddy_clear_done,
                             NULL);
        gaim_timeout_remove(gaym->timer);
        gaym->timer =
            gaim_timeout_add(BLIST_UPDATE_PERIOD,
                             (GSourceFunc) gaym_blist_timeout,
                             (gpointer) gaym);
        g_free(list);
        g_free(blist_whois);

        return TRUE;
    }
    gaym->blist_updating = TRUE;
    buf = gaym_format(gaym, "vn", "WHOIS", list);
    gaym_send(gaym, buf);
    gaim_timeout_remove(gaym->timer);
    gaym->timer =
        gaim_timeout_add(BLIST_CHUNK_INTERVAL,
                         (GSourceFunc) gaym_blist_timeout,
                         (gpointer) gaym);

    g_free(buf);
    g_free(list);
    g_free(blist_whois);

    return TRUE;
}
Ejemplo n.º 6
0
void
gaim_pounces_uninit()
{
	if (pounces_save_timer != 0) {
		gaim_timeout_remove(pounces_save_timer);
		pounces_save_timer = 0;
		gaim_pounces_sync();
	}

	gaim_signals_disconnect_by_handle(gaim_pounces_get_handle());
}
Ejemplo n.º 7
0
static void
update_keepalive(GaimConnection *gc, gboolean on)
{
	GaimPluginProtocolInfo *prpl_info = NULL;

	if (gc != NULL && gc->prpl != NULL)
		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);

	if (!prpl_info || !prpl_info->keepalive)
		return;

	if (on && !gc->keepalive)
	{
		gaim_debug_info("connection", "Activating keepalive.\n");
		gc->keepalive = gaim_timeout_add(30000, send_keepalive, gc);
	}
	else if (!on && gc->keepalive > 0)
	{
		gaim_debug_info("connection", "Deactivating keepalive.\n");
		gaim_timeout_remove(gc->keepalive);
		gc->keepalive = 0;
	}
}
Ejemplo n.º 8
0
void
gaim_connection_destroy(GaimConnection *gc)
{
	GaimAccount *account;
	GSList *buddies, *tmp;
#if 0
	GList *wins;
#endif
	GaimPluginProtocolInfo *prpl_info = NULL;
	gboolean remove = FALSE;

	g_return_if_fail(gc != NULL);

	account = gaim_connection_get_account(gc);

	gaim_debug_info("connection", "Disconnecting connection %p\n", gc);

	if (gaim_connection_get_state(gc) != GAIM_CONNECTING)
		remove = TRUE;

	gaim_signal_emit(gaim_connections_get_handle(), "signing-off", gc);

	while (gc->buddy_chats)
	{
		GaimConversation *b = gc->buddy_chats->data;

		gc->buddy_chats = g_slist_remove(gc->buddy_chats, b);
		gaim_conv_chat_left(GAIM_CONV_CHAT(b));
	}

	update_keepalive(gc, FALSE);

	gaim_proxy_connect_cancel_with_handle(gc);

	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
	if (prpl_info->close)
		(prpl_info->close)(gc);

	/* Clear out the proto data that was freed in the prpl close method*/
	buddies = gaim_find_buddies(account, NULL);
	for (tmp = buddies; tmp; tmp = tmp->next) {
		GaimBuddy *buddy = tmp->data;
		buddy->proto_data = NULL;
	}
	g_slist_free(buddies);

	connections = g_list_remove(connections, gc);

	gaim_connection_set_state(gc, GAIM_DISCONNECTED);

	if (remove)
		gaim_blist_remove_account(account);

	gaim_signal_emit(gaim_connections_get_handle(), "signed-off", gc);

#if 0
	/* see comment later in file on if 0'd same code */
	/*
	 * 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) {
		GaimConvWindow *win = (GaimConvWindow *)wins->data;
		gaim_conversation_update(gaim_conv_window_get_conversation_at(win, 0),
								 GAIM_CONV_ACCOUNT_OFFLINE);
	}
#endif

	gaim_request_close_with_handle(gc);
	gaim_notify_close_with_handle(gc);

	gaim_debug_info("connection", "Destroying connection %p\n", gc);

	gaim_account_set_connection(account, NULL);

	g_free(gc->password);
	g_free(gc->display_name);

	if (gc->disconnect_timeout)
		gaim_timeout_remove(gc->disconnect_timeout);

	GAIM_DBUS_UNREGISTER_POINTER(gc);
	g_free(gc);
}