93 lines
1.6 KiB
C
93 lines
1.6 KiB
C
#ifndef IRC_STRUCTS_H
|
|
#define IRC_STRUCTS_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
typedef enum
|
|
{
|
|
SASL_MECHANISM_NONE,
|
|
SASL_MECHANISM_PLAIN,
|
|
SASL_MECHANISM_EXTERNAL
|
|
} irc_sasl_mechanism_t;
|
|
|
|
typedef struct
|
|
{
|
|
char nickname[32];
|
|
char ident[16];
|
|
char hostname;
|
|
} irc_hostmask_t;
|
|
|
|
typedef struct {
|
|
char line[513];
|
|
char *source;
|
|
char *command;
|
|
char *argv[16];
|
|
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 capLine[96]; // A place for name and args to point to.
|
|
char *name;
|
|
char *args;
|
|
} irc_capability_t;
|
|
|
|
typedef struct
|
|
{
|
|
char username[32];
|
|
char password[64];
|
|
} irc_sasl_plain_credentials_t;
|
|
|
|
typedef struct
|
|
{
|
|
char nickname[32];
|
|
unsigned char fingerprint[20];
|
|
} irc_sasl_external_credentials_t;
|
|
|
|
typedef struct
|
|
{
|
|
irc_sasl_mechanism_t mechanism;
|
|
union {
|
|
irc_sasl_plain_credentials_t plain_credentials;
|
|
irc_sasl_external_credentials_t external_credentials;
|
|
};
|
|
} irc_auth_t;
|
|
|
|
typedef struct
|
|
{
|
|
int sockfd;
|
|
irc_hostmask_t ownHostmask;
|
|
char supportedCapabilities[512];
|
|
char requestedCapabilities[512];
|
|
irc_capability_t acked[24];
|
|
|
|
/* Authentication parameters */
|
|
irc_auth_t saslAuth;
|
|
} irc_client_t;
|
|
|
|
typedef struct
|
|
{
|
|
char nick[32];
|
|
char ident[16];
|
|
char realname[64];
|
|
} irc_identity_t;
|
|
|
|
typedef struct {
|
|
const char *name;
|
|
void (*handler)(irc_message_t *msg, irc_client_t *irc);
|
|
} command_t;
|
|
|
|
#endif |