src/test/irc_chan.h
branchnew-transport
changeset 168 a58ad50911fc
equal deleted inserted replaced
167:0d2d8ca879d8 168:a58ad50911fc
       
     1 #ifndef TEST_IRC_CHAN_H
       
     2 #define TEST_IRC_CHAN_H
       
     3 
       
     4 /**
       
     5  * @file
       
     6  *
       
     7  * Utility functions for testing irc_chan
       
     8  */
       
     9 #include "../irc_chan.h"
       
    10 #include "transport.h"
       
    11 
       
    12 /**
       
    13  * Callback context
       
    14  */
       
    15 struct test_chan_ctx {
       
    16     /** The channel name */
       
    17     const char *channel;
       
    18 
       
    19     /** The channel we're supposed to be testing */
       
    20     struct irc_chan *chan;
       
    21     
       
    22     /** Flags for callbacks called*/
       
    23     bool on_chan_self_join, on_chan_self_part, on_chan_join, on_chan_part;
       
    24 
       
    25 };
       
    26 
       
    27 /**
       
    28  * Ensure that an irc_chan_user exists/doesn't exist for the given channel/nickname, and return it.
       
    29  */
       
    30 struct irc_chan_user* check_chan_user (struct irc_chan *chan, const char *nickname, bool exists);
       
    31 
       
    32 /**
       
    33  * Creates an irc_chan on the given irc_net, sends the JOIN stuff plus RPL_NAMREPLY
       
    34  */
       
    35 struct irc_chan* setup_irc_chan (struct transport_test *tp, struct irc_net *net, const char *channel, struct test_chan_ctx *ctx);
       
    36 
       
    37 
       
    38 #endif /* TEST_IRC_CHAN_H */