WIP commit
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
#ifndef IRC_H
|
||||
#define IRC_H
|
||||
|
||||
#include <stdbool.h>
|
||||
typedef enum
|
||||
{
|
||||
PLAIN,
|
||||
EXTERNAL
|
||||
} irc_sasl_method_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *nickname;
|
||||
@@ -9,7 +16,6 @@ typedef struct
|
||||
int identlen;
|
||||
char *hostname;
|
||||
int hostlen;
|
||||
|
||||
} irc_hostmask_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -17,13 +23,35 @@ typedef struct {
|
||||
char *source;
|
||||
char *command;
|
||||
char *argv[16];
|
||||
int argc;
|
||||
int argc;
|
||||
} irc_message_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
irc_hostmask_t hostmask;
|
||||
char prefix;
|
||||
} irc_chanuser_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
char topic[512];
|
||||
irc_chanuser_t* users;
|
||||
} irc_channel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[32];
|
||||
char args[64];
|
||||
} irc_capability_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sockfd;
|
||||
irc_hostmask_t ownHostmask;
|
||||
char supportedCapabilities[512];
|
||||
char* requestedCapabilities;
|
||||
} irc_client_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -31,9 +59,23 @@ typedef struct {
|
||||
void (*handler)(irc_message_t *msg, irc_client_t *irc);
|
||||
} command_t;
|
||||
|
||||
int IRC_ParseMessage(char* line, irc_message_t *msg);
|
||||
void IRC_ParseMessage(char* line, irc_message_t *msg);
|
||||
void IRC_ProcessMessage(irc_message_t *msg, irc_client_t *irc);
|
||||
|
||||
void IRC_PRIVMSG(char* msg, irc_client_t irc);
|
||||
// various IRC commands
|
||||
void IRC_PRIVMSG(char* to, char* msg, irc_client_t *irc);
|
||||
void IRC_NOTICE(char* to, char* msg, irc_client_t *irc);
|
||||
void IRC_NICK(char *nick, irc_client_t *irc);
|
||||
void IRC_USER(char *ident, char* realname, irc_client_t *irc);
|
||||
|
||||
// registration
|
||||
void IRC_Register(char *nick, char* ident, char *realname, bool saslEnabled, irc_sasl_method_t saslMethod, char *saslUsername, char *saslPassword, irc_client_t *irc);
|
||||
|
||||
// Capability negotiation block
|
||||
void IRC_StartCapabilityNegotiation(irc_client_t *irc);
|
||||
void IRC_RequestCapabilities(char* caps, irc_client_t *irc);
|
||||
void IRC_EndCapabilityNegotiation(irc_client_t *irc);
|
||||
|
||||
int IRC_ParseCapabilities(char* caps, irc_capability_t *capabilities, int capsLength);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user