libircclient: Initiating and destroying IRC session.

# Initiating and destroying IRC session.

## Functions
irc_session_t * | irc_create_session (irc_callbacks_t *callbacks)
| Creates and initiates a new IRC session.
void | irc_destroy_session (irc_session_t *session)
| Destroys previously created IRC session.

## Function Documentation

irc_session_t * irc_create_session | ( | irc_callbacks_t * | callbacks | ) |

Creates and initiates a new IRC session.

Parameters:

  | callbacks | A structure, which defines several callbacks, which will be called on appropriate events. Must not be NULL.

Returns:
  An irc_session_t object, or 0 if creation failed. Usually, failure is caused by out of memory error.

Every irc_session_t object describes a single IRC session - a connection to an IRC server, and possibly to some DCC clients. Almost every irc_* function requires this object to be passed to, and therefore this function should be called first.

Every session created must be destroyed when it is not needed anymore by calling irc_destroy_session().

The most common function sequence is:

      ... prepare irc_callbacks_t structure ...
      irc_create_session();
      irc_connect();
      irc_run();
      irc_destroy_session();

See also:
  irc_destroy_session

void irc_destroy_session | ( | irc_session_t * | session | ) |

Destroys previously created IRC session.

Parameters:

  | session | A session to destroy. Must not be NULL.

This function should be used to destroy an IRC session, close the connection to the IRC server, and free all the used resources. After calling this function, you should not use this session object anymore.