src/irc_cmd.h
changeset 23 542c73d07d3c
parent 22 c339c020fd33
child 37 4fe4a3c4496e
equal deleted inserted replaced
22:c339c020fd33 23:542c73d07d3c
     1 #ifndef IRC_CMD_H
     1 #ifndef IRC_CMD_H
     2 #define IRC_CMD_H
     2 #define IRC_CMD_H
       
     3 
       
     4 /**
       
     5  * @file
       
     6  *
       
     7  * Flexible command handlers callback lists for use with irc_lines
       
     8  */
       
     9 
       
    10 #include "irc_conn.h"
       
    11 #include "irc_line.h"
       
    12 #include <sys/queue.h>
       
    13 
       
    14 /**
       
    15  * Single command -> handler mapping for lookup
       
    16  */
       
    17 struct irc_cmd_handler {
       
    18     /** The command name to match */
       
    19     const char *command;
       
    20 
       
    21     /** The handler function */
       
    22     void (*func) (struct irc_conn *conn, const struct irc_line *line, void *arg);
       
    23 };
       
    24 
       
    25 /**
       
    26  * List item for a chain of irc_cmd_handler entries, with the context pointer
       
    27  */
       
    28 struct irc_cmd_chain {
       
    29     /** The list of handler lookup entries */
       
    30     struct irc_cmd_handler *handlers;
       
    31 
       
    32     /** Opaque context arg */
       
    33     void *arg;
       
    34 
       
    35     /** Linked list */
       
    36     STAILQ_ENTRY(irc_cmd_chain) node;
       
    37 };
     3 
    38 
     4 /*
    39 /*
     5  * IRC command numerics
    40  * IRC command numerics
     6  */
    41  */
     7 #define IRC_RPL_WELCOME         "001"
    42 #define IRC_RPL_WELCOME         "001"