Esempio n. 1
0
int server_unref(SERVER_REC *server)
{
	g_return_val_if_fail(IS_SERVER(server), FALSE);

	if (--server->refcount > 0)
		return TRUE;

	if (g_slist_find(servers, server) != NULL) {
		g_warning("Non-referenced server wasn't disconnected");
		server_disconnect(server);
		return TRUE;
	}

        MODULE_DATA_DEINIT(server);
	server_connect_unref(server->connrec);
	if (server->rawlog != NULL) rawlog_destroy(server->rawlog);
	if (server->buffer != NULL) line_split_free(server->buffer);
	g_free(server->version);
	g_free(server->away_reason);
	g_free(server->nick);
	g_free(server->tag);

	server->type = 0;
	g_free(server);
        return FALSE;
}
Esempio n. 2
0
void channel_destroy(CHANNEL_REC *channel)
{
	g_return_if_fail(IS_CHANNEL(channel));

	if (channel->destroying) return;
	channel->destroying = TRUE;

	channels = g_slist_remove(channels, channel);
	channel->server->channels =
		g_slist_remove(channel->server->channels, channel);

	signal_emit("channel destroyed", 1, channel);

        MODULE_DATA_DEINIT(channel);
	g_free_not_null(channel->hilight_color);
	g_free_not_null(channel->topic);
	g_free_not_null(channel->topic_by);
	g_free_not_null(channel->key);
	g_free(channel->mode);
	g_free(channel->name);
	g_free(channel->visible_name);

        channel->type = 0;
	g_free(channel);
}
Esempio n. 3
0
static void exec_wi_destroy(EXEC_WI_REC *rec)
{
        g_return_if_fail(rec != NULL);

	if (rec->destroying) return;
        rec->destroying = TRUE;

	if (window_item_window((WI_ITEM_REC *) rec) != NULL)
		window_item_destroy((WI_ITEM_REC *) rec);

	MODULE_DATA_DEINIT(rec);
	g_free(rec->name);
        g_free(rec);
}
Esempio n. 4
0
void query_destroy(QUERY_REC *query)
{
	g_return_if_fail(query != NULL);

        if (query->destroying) return;
	query->destroying = TRUE;

	queries = g_slist_remove(queries, query);
	if (query->server != NULL)
		query->server->queries = g_slist_remove(query->server->queries, query);
	signal_emit("query destroyed", 1, query);

        MODULE_DATA_DEINIT(query);
        g_free_not_null(query->address);
	g_free(query->nick);
        g_free(query->server_tag);
	g_free(query);
}
Esempio n. 5
0
void query_destroy(QUERY_REC *query)
{
    g_return_if_fail(IS_QUERY(query));

    if (query->destroying) return;
    query->destroying = TRUE;

    queries = g_slist_remove(queries, query);
    if (query->server != NULL) {
        query->server->queries =
            g_slist_remove(query->server->queries, query);
    }
    signal_emit("query destroyed", 1, query);

    MODULE_DATA_DEINIT(query);
    g_free_not_null(query->hilight_color);
    g_free_not_null(query->server_tag);
    g_free_not_null(query->address);
    g_free(query->name);

    query->type = 0;
    g_free(query);
}
Esempio n. 6
0
/* Destroy DCC record */
void dcc_destroy(DCC_REC *dcc)
{
	g_return_if_fail(dcc != NULL);
	if (dcc->destroyed) return;

	dcc_conns = g_slist_remove(dcc_conns, dcc);

	dcc->destroyed = TRUE;
	signal_emit("dcc destroyed", 1, dcc);

	if (dcc->handle != NULL) net_disconnect(dcc->handle);
	if (dcc->tagconn != -1) g_source_remove(dcc->tagconn);
	if (dcc->tagread != -1) g_source_remove(dcc->tagread);
	if (dcc->tagwrite != -1) g_source_remove(dcc->tagwrite);

        MODULE_DATA_DEINIT(dcc);
	g_free_not_null(dcc->servertag);
	g_free_not_null(dcc->target);
	g_free(dcc->mynick);
	g_free(dcc->nick);
	g_free(dcc->arg);
	g_free(dcc);
}