src/test/irc_chan.h
author Tero Marttila <terom@fixme.fi>
Mon, 04 May 2009 20:55:04 +0300
branchnew-transport
changeset 168 a58ad50911fc
permissions -rw-r--r--
refactor test.c into tests/*
#ifndef TEST_IRC_CHAN_H
#define TEST_IRC_CHAN_H

/**
 * @file
 *
 * Utility functions for testing irc_chan
 */
#include "../irc_chan.h"
#include "transport.h"

/**
 * Callback context
 */
struct test_chan_ctx {
    /** The channel name */
    const char *channel;

    /** The channel we're supposed to be testing */
    struct irc_chan *chan;
    
    /** Flags for callbacks called*/
    bool on_chan_self_join, on_chan_self_part, on_chan_join, on_chan_part;

};

/**
 * Ensure that an irc_chan_user exists/doesn't exist for the given channel/nickname, and return it.
 */
struct irc_chan_user* check_chan_user (struct irc_chan *chan, const char *nickname, bool exists);

/**
 * Creates an irc_chan on the given irc_net, sends the JOIN stuff plus RPL_NAMREPLY
 */
struct irc_chan* setup_irc_chan (struct transport_test *tp, struct irc_net *net, const char *channel, struct test_chan_ctx *ctx);


#endif /* TEST_IRC_CHAN_H */