47 lines
802 B
C
47 lines
802 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
#define USER_PERMS 4
|
|
#define USER_MOD 0
|
|
#define USER_LOGS 1
|
|
#define USER_NICK 2
|
|
#define USER_CHAN 3
|
|
|
|
typedef struct {
|
|
int id;
|
|
char name[64];
|
|
int perms[USER_PERMS];
|
|
int color;
|
|
} user_t;
|
|
|
|
#define CHAN_PARAMS 2
|
|
#define CHAN_PWD 0
|
|
#define CHAN_TMP 1
|
|
|
|
typedef struct {
|
|
char name[64];
|
|
int params[CHAN_PARAMS];
|
|
} channel_t;
|
|
|
|
void ctx_init();
|
|
void ctx_free();
|
|
|
|
int parse_color(const char*);
|
|
uint64_t parse_flags(const char*);
|
|
void parse_perms(const char*, int, int*);
|
|
|
|
void add_user(const user_t*);
|
|
const user_t* get_user(int);
|
|
void rm_user(int);
|
|
|
|
void set_self(int);
|
|
const user_t* get_self();
|
|
int get_self_id();
|
|
|
|
void add_channel(const channel_t*);
|
|
const channel_t* get_channel(const char*);
|
|
void rm_channel(const char*);
|
|
|