fixed
This commit is contained in:
parent
a620a5d2d0
commit
718f290ba4
3 changed files with 176 additions and 46 deletions
40
C/irc.h
40
C/irc.h
|
@ -10,42 +10,50 @@
|
|||
#ifndef _IRCC_H
|
||||
#define _IRCC_H
|
||||
|
||||
#define IRCC_MSG_MAX 512
|
||||
#define IRCC_PING_TIMEOUT 600
|
||||
#define IRCC_VERSION "2.0.2"
|
||||
#define IRCC_VERSION "2.1.0b"
|
||||
|
||||
#if defined(ENABLE_SSL) || defined(ENABLE_TLS)
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
IRCC_NICK = 1,
|
||||
IRCC_ALLOC = -3,
|
||||
IRCC_DISCONNECTED,
|
||||
IRCC_ERROR,
|
||||
|
||||
IRCC_CONNECTED,
|
||||
IRCC_SUCCESS,
|
||||
|
||||
IRCC_NICK,
|
||||
IRCC_PRIVMSG,
|
||||
IRCC_JOIN,
|
||||
IRCC_QUIT,
|
||||
IRCC_PING,
|
||||
IRCC_TOPIC,
|
||||
IRCC_MODE,
|
||||
|
||||
IRCC_CONNECTED,
|
||||
IRCC_DISCONNECTED,
|
||||
IRCC_ERROR,
|
||||
IRCC_SUCCESS
|
||||
IRCC_MODE
|
||||
};
|
||||
|
||||
static const char *IRCC_ERROR_MSGS[] = {
|
||||
"IRCC_ALLOC",
|
||||
"IRCC_DISCONNECTED",
|
||||
"IRCC_ERROR",
|
||||
};
|
||||
|
||||
#define IRCC_GET_ERROR(n) (IRCC_ERROR_MSGS[n + 3])
|
||||
|
||||
typedef struct {
|
||||
/* RW */
|
||||
int irc_connected;
|
||||
int irc_socket;
|
||||
|
||||
char irc_raw[IRCC_MSG_MAX + 1];
|
||||
int irc_alloc;
|
||||
char *irc_raw;
|
||||
|
||||
/* RONLY */
|
||||
char *irc_msg;
|
||||
char *irc_channel;
|
||||
char *irc_nick;
|
||||
|
||||
int irc_alloc;
|
||||
|
||||
#if defined(ENABLE_SSL) || defined(ENABLE_TLS)
|
||||
/* RONLY */
|
||||
int irc_usingssl;
|
||||
|
@ -60,14 +68,14 @@ typedef struct {
|
|||
int IRCC_connect(IRCC_client *irc, const char *ip, const int port);
|
||||
int IRCC_recv(IRCC_client *irc);
|
||||
int IRCC_parse(IRCC_client *irc);
|
||||
int IRCC_register(IRCC_client *irc, const char *nickname);
|
||||
int IRCC_join(IRCC_client *irc, const char *channel, const char *key);
|
||||
int IRCC_send(IRCC_client *irc, const char *channel, const char *msg);
|
||||
int IRCC_register(IRCC_client *irc, const char *nickname);
|
||||
int IRCC_initssl(IRCC_client *irc);
|
||||
void IRCC_close(IRCC_client *irc);
|
||||
|
||||
/* Raw data operations. Uses tls when possible */
|
||||
int IRCC_usend(IRCC_client *irc, const char *msg, const int bytes);
|
||||
int IRCC_urecv(IRCC_client *irc);
|
||||
int IRCC_usend(IRCC_client *irc, const char *msg, const size_t size);
|
||||
int IRCC_urecv(IRCC_client *irc, char **buf, const size_t size);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue