irclibs/C/irc.h
2024-01-23 16:43:32 +00:00

46 lines
894 B
C

/*
LICENSE: WTFPL
Simple libary for working with ipv4 irc servers
Dont support:
ssl
ddc
ipv6
motd
*/
#define IRCC_MSG_MAX 512
#define IRCC_PING_TIMEOUT 600
enum {
IRCC_NICK = 1,
IRCC_PRIVMSG,
IRCC_JOIN,
IRCC_PART,
IRCC_PING,
IRCC_TOPIC,
IRCC_MODE,
IRCC_CONNECTED,
IRCC_DISCONNECTED,
IRCC_ERROR,
IRCC_SUCCESS
};
typedef struct {
int irc_socket;
char irc_raw[IRCC_MSG_MAX + 1];
char *irc_msg;
char *irc_channel;
char *irc_nick;
} IRCC_client;
int IRCC_connect(IRCC_client *irc, const char *ip, const unsigned int port);
int IRCC_recv(IRCC_client *irc);
int IRCC_parse(IRCC_client *irc);
int IRCC_join(IRCC_client *irc, const char *channel, const char *key);
int IRCC_send(IRCC_client *irc, const char *msg, const char *channel);
int IRCC_register(IRCC_client *irc, const char *nickname);
void IRCC_init(IRCC_client *irc);
void IRCC_close(IRCC_client *irc);