src/irc_client.h
author Tero Marttila <terom@fixme.fi>
Fri, 13 Mar 2009 16:10:48 +0200
changeset 53 12d806823775
child 55 6f7f6ae729d0
permissions -rw-r--r--
add irc_client module, plus nexus.h header
#ifndef IRC_CLIENT_H
#define IRC_CLIENT_H

/**
 * @file
 * 
 * Defines the high-level, full-featured IRC 'client' state, which essentially manipulates a set of irc_net's
 */
#include "irc_net.h"
#include <sys/queue.h>

/**
 * The IRC client
 */
struct irc_client {
    /** Our set of configured IRC networks */
    TAILQ_HEAD(irc_client_networks, irc_net) networks;

    /** Are we in the process of quitting all networks? */
    bool quitting;

    /** Have we quit all networks? */
    bool quit;
};

/**
 * Construct a new irc_client
 */
err_t irc_client_create (struct irc_client **client_ptr, struct error_info *err);

/**
 * Destroy the irc_client, also destroying all networks
 */
void irc_client_destroy (struct irc_client *client);

/**
 * Add a new IRC network
 */
err_t irc_client_add_net (struct irc_client *client, struct irc_net **net_ptr, struct irc_net_info *net_info);

/**
 * Get a pre-existing IRC network by name
 */
struct irc_net* irc_client_get_net (struct irc_client *client, const char *network);

/**
 * Quit cleanly from all our IRC networks.
 *
 * XXX: currently no way to indicate once we've quit all of them
 */
err_t irc_client_quit (struct irc_client *client, const char *message);

#endif