src/irc_cmd.h
author Tero Marttila <terom@fixme.fi>
Sun, 08 Mar 2009 17:17:37 +0200
changeset 23 542c73d07d3c
parent 22 c339c020fd33
child 37 4fe4a3c4496e
permissions -rw-r--r--
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
#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
 */
#define IRC_RPL_WELCOME         "001"


#endif /* IRC_CMD_H */