src/irc_client.h
author Tero Marttila <terom@fixme.fi>
Sun, 15 Mar 2009 01:17:22 +0200
branchmodules
changeset 55 6f7f6ae729d0
parent 53 12d806823775
child 63 d399a1d915a3
permissions -rw-r--r--
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
#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);

/**
 * Get an irc_chan by network/channel name
 */
struct irc_chan* irc_client_get_chan (struct irc_client *client, const char *network, const char *channel);

/**
 * 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