2015-03-24 10:48:11 -07:00
|
|
|
#ifndef EVENTS_H
|
|
|
|
#define EVENTS_H
|
|
|
|
|
|
|
|
#include "irc.h"
|
|
|
|
|
2015-04-08 11:56:32 -07:00
|
|
|
#define PRIVMSG_SELF "CMSG"
|
|
|
|
#define PRIVMSG_CHAN "PMSG"
|
|
|
|
#define JOIN "JOIN"
|
|
|
|
#define IRC_CONNECTED "001"
|
2015-03-26 16:20:59 -07:00
|
|
|
|
|
|
|
struct handler
|
|
|
|
{
|
2015-04-08 11:56:32 -07:00
|
|
|
char *type;
|
2015-03-26 16:20:59 -07:00
|
|
|
int count;
|
|
|
|
void **handlers;
|
|
|
|
};
|
|
|
|
|
2015-04-18 08:51:15 -07:00
|
|
|
struct event
|
|
|
|
{
|
|
|
|
char *type;
|
|
|
|
char *user;
|
|
|
|
char *chan;
|
|
|
|
char *text;
|
|
|
|
};
|
|
|
|
|
2015-03-26 16:20:59 -07:00
|
|
|
void init_events();
|
2015-04-08 11:56:32 -07:00
|
|
|
int add_handler(char *type, void *handler);
|
|
|
|
void del_handler(int num, char *type);
|
|
|
|
void handle_connected(struct irc_conn *bot, char *text);
|
2015-03-24 10:48:11 -07:00
|
|
|
void handle_chan_privmsg(struct irc_conn *bot, char *user, char *chan, char *text);
|
|
|
|
void handle_self_privmsg(struct irc_conn *bot, char *user, char *text);
|
2015-03-26 16:20:59 -07:00
|
|
|
void handle_join(struct irc_conn *bot, char *user, char *chan);
|
2015-03-24 10:48:11 -07:00
|
|
|
|
|
|
|
#endif
|