xbot/lib/events.h

40 lines
881 B
C
Raw Normal View History

2015-03-24 17:48:11 +00:00
#ifndef EVENTS_H
#define EVENTS_H
#include "irc.h"
2015-04-08 18:56:32 +00:00
#define PRIVMSG_SELF "CMSG"
#define PRIVMSG_CHAN "PMSG"
2024-02-13 07:22:10 +00:00
#define PRIVMSG_USER "UMSG"
2015-04-08 18:56:32 +00:00
#define JOIN "JOIN"
2024-02-13 07:22:10 +00:00
#define PART "PART"
#define QUIT "QUIT"
2015-04-08 18:56:32 +00:00
#define IRC_CONNECTED "001"
2024-02-13 07:22:10 +00:00
#define IRC_MOTD "372"
#define IRC_END_MOTD "376"
2015-03-26 23:20:59 +00:00
struct handler
{
2024-02-13 07:22:10 +00:00
char *type;
int count;
void **handlers;
2015-03-26 23:20:59 +00:00
};
2015-04-18 15:51:15 +00:00
struct event
{
2024-02-13 07:22:10 +00:00
char *type;
char *user;
char *chan;
char *text;
2015-04-18 15:51:15 +00:00
};
2015-03-26 23:20:59 +00:00
void init_events();
2024-02-13 07:22:10 +00:00
MY_API int add_handler(char *type, void *handler);
2015-04-08 18:56:32 +00:00
void del_handler(int num, char *type);
void handle_connected(struct irc_conn *bot, char *text);
2015-03-24 17:48:11 +00: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 23:20:59 +00:00
void handle_join(struct irc_conn *bot, char *user, char *chan);
2015-03-24 17:48:11 +00:00
2024-02-13 07:22:10 +00:00
#endif