--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/irc_conn.h Sat Feb 28 22:47:39 2009 +0200
@@ -0,0 +1,58 @@
+#ifndef IRC_CONN_H
+#define IRC_CONN_H
+
+/*
+ * Per-connection IRC setup and state/protocol handling.
+ */
+
+#include "sock.h"
+#include "line_proto.h"
+#include "irc_line.h"
+#include "error.h"
+
+/*
+ * A connection to an IRC server.
+ */
+struct irc_conn {
+ /* We are a line-based protocol */
+ struct line_proto *lp;
+};
+
+// XXX: this should probably be slightly reworked
+struct irc_conn_config {
+ /* Nickname to use on that server */
+ const char *nickname;
+
+ /* Username to supply */
+ const char *username;
+
+ /* Realname to supply */
+ const char *realname;
+};
+
+/*
+ * Create a new irc_conn using the given sock_stream, which should be connected to an IRC server. The parameters given
+ * in \a config will be used to identify with the IRC server.
+ *
+ * On success, the resulting irc_conn is returned via *conn with SUCCESS. Otherwise, -ERR_* and error info is returned
+ * via *err.
+ */
+err_t irc_conn_create (struct irc_conn **conn, struct sock_stream *sock, const struct irc_conn_config *config, struct error_info *err);
+
+/*
+ * Send an IRC message directly
+ */
+err_t irc_conn_send (struct irc_conn *conn, const struct irc_line *line);
+
+/*
+ * Send a NICK message
+ */
+err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname);
+
+/*
+ * Send a USER message
+ */
+err_t irc_conn_USER (struct irc_conn *conn, const char *username, const char *realname);
+
+
+#endif /* IRC_CONN_H */