Exemplo n.º 1
0
void irc_destroy_session (irc_session_t * session)
{
	free_ircsession_strings( session );

	// The CTCP VERSION must be freed only now
	if ( session->ctcp_version )
		free (session->ctcp_version);

	if ( session->sock >= 0 )
		socket_close (&session->sock);

#if defined (ENABLE_THREADS)
	libirc_mutex_destroy (&session->mutex_session);
#endif

#if defined (ENABLE_SSL)
	if ( session->ssl )
		SSL_free( session->ssl );
#endif

	/*
	 * delete DCC data
	 * libirc_remove_dcc_session removes the DCC session from the list.
	 */
	while ( session->dcc_sessions )
		libirc_remove_dcc_session (session, session->dcc_sessions, 0);

	libirc_mutex_destroy (&session->mutex_dcc);

	free (session);
}
Exemplo n.º 2
0
static void libirc_remove_dcc_session (irc_session_t * session, irc_dcc_session_t * dcc, int lock_list)
{
	if ( dcc->sock >= 0 )
		socket_close (&dcc->sock);

	if ( dcc->dccsend_file_fp )
		fclose (dcc->dccsend_file_fp);

	dcc->dccsend_file_fp = 0;

	libirc_mutex_destroy (&dcc->mutex_outbuf);

	if ( lock_list )
		libirc_mutex_lock (&session->mutex_dcc);

	if ( session->dcc_sessions != dcc )
	{
		irc_dcc_session_t * s;
		for ( s = session->dcc_sessions; s; s = s->next )
		{
			if ( s->next == dcc )
			{
				s->next = dcc->next;
				break;
			}
		}
	}
	else
		session->dcc_sessions = dcc->next;

	if ( lock_list )
		libirc_mutex_unlock (&session->mutex_dcc);

	free (dcc);
}
Exemplo n.º 3
0
void irc_destroy_session (irc_session_t * session)
{
	if ( session->sock >= 0 )
		socket_close (&session->sock);

	if ( session->realname )
		free (session->realname);

	if ( session->username )
		free (session->username);

	if ( session->nick )
		free (session->nick);

	if ( session->server )
		free (session->server);

	if ( session->server_password )
		free (session->server_password);

#if defined (ENABLE_THREADS)
	libirc_mutex_destroy (&session->mutex_session);
#endif

	/*
	 * delete DCC data
	 * libirc_remove_dcc_session removes the DCC session from the list.
	 */
	while ( session->dcc_sessions )
		libirc_remove_dcc_session (session, session->dcc_sessions, 0);

	free (session);
}
Exemplo n.º 4
0
void irc_destroy_session(irc_session_t * session) {
    free_ircsession_strings(session);

    if (session->sock >= 0)
        socket_close(&session->sock);

#if defined (ENABLE_THREADS)
    libirc_mutex_destroy(&session->mutex_session);
#endif

    while (session->dcc_sessions)
        libirc_remove_dcc_session(session, session->dcc_sessions, 0);

    free_line_parser(session->line_parser);
    fdwatch_free();

#ifdef ENABLE_SSL
    if (session->ssl)
        SSL_free(session->ssl);
#endif

    free(session);
}