src/irc_cmd.h
changeset 23 542c73d07d3c
parent 22 c339c020fd33
child 37 4fe4a3c4496e
--- a/src/irc_cmd.h	Sun Mar 01 02:02:48 2009 +0200
+++ b/src/irc_cmd.h	Sun Mar 08 17:17:37 2009 +0200
@@ -1,6 +1,41 @@
 #ifndef IRC_CMD_H
 #define IRC_CMD_H
 
+/**
+ * @file
+ *
+ * Flexible command handlers callback lists for use with irc_lines
+ */
+
+#include "irc_conn.h"
+#include "irc_line.h"
+#include <sys/queue.h>
+
+/**
+ * Single command -> handler mapping for lookup
+ */
+struct irc_cmd_handler {
+    /** The command name to match */
+    const char *command;
+
+    /** The handler function */
+    void (*func) (struct irc_conn *conn, const struct irc_line *line, void *arg);
+};
+
+/**
+ * List item for a chain of irc_cmd_handler entries, with the context pointer
+ */
+struct irc_cmd_chain {
+    /** The list of handler lookup entries */
+    struct irc_cmd_handler *handlers;
+
+    /** Opaque context arg */
+    void *arg;
+
+    /** Linked list */
+    STAILQ_ENTRY(irc_cmd_chain) node;
+};
+
 /*
  * IRC command numerics
  */