xbot/lib/events.h

45 lines
963 B
C
Raw Normal View History

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"
2024-02-16 13:28:11 -08:00
#define JOIN_MYSELF "JOIN_MYSELF"
2024-02-12 23:22:10 -08:00
#define PART "PART"
2024-02-16 13:28:11 -08:00
#define PART_MYSELF "PART_MYSELF"
2024-02-12 23:22:10 -08:00
#define QUIT "QUIT"
2024-02-16 13:28:11 -08:00
#define NICK "NICK"
#define NICK_MYSELF "NICK_MYSELF"
#define NICK_INUSE "433"
#define CTCP "CTCP"
2015-04-08 11:56:32 -07:00
#define IRC_CONNECTED "001"
2024-02-12 23:22:10 -08:00
#define IRC_MOTD "372"
#define IRC_END_MOTD "376"
2024-02-16 13:28:11 -08:00
#define IRC_NAMREPLY "353"
#define IRC_WHOREPLY "352"
2024-02-21 06:24:49 -08:00
#define TICK "TICK"
2015-03-26 16:20:59 -07:00
2024-02-13 02:56:23 -08:00
struct ev_handler
2015-03-26 16:20:59 -07:00
{
2024-02-13 02:56:23 -08:00
int id;
void *handler;
2015-03-26 16:20:59 -07:00
};
2024-02-13 02:56:23 -08:00
struct handler
2015-04-18 08:51:15 -07:00
{
2024-02-12 23:22:10 -08:00
char *type;
2024-02-13 02:56:23 -08:00
int count;
struct ev_handler *evhands;
2015-04-18 08:51:15 -07:00
};
2024-02-23 17:57:59 -08:00
extern struct handler *handlers[512];
2024-02-13 02:56:23 -08:00
2015-03-26 16:20:59 -07:00
void init_events();
2024-02-12 23:22:10 -08:00
MY_API int add_handler(char *type, void *handler);
MY_API void del_handler(char *type, void *handler);
2024-02-13 02:56:23 -08:00
void fire_handler(struct irc_conn *bot, char *type, ...);
2015-03-24 10:48:11 -07:00
2024-02-12 23:22:10 -08:00
#endif