src/test/irc_chan.h
branchnew-transport
changeset 168 a58ad50911fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/irc_chan.h	Mon May 04 20:55:04 2009 +0300
@@ -0,0 +1,38 @@
+#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 */