xbot/lib/events.h

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