~rcr/rirc

ref: 7ca2a99a605b7e0b88fa85bc43a8fadc13695ba8 rirc/src/components/user.h -rw-r--r-- 795 bytes
7ca2a99a — Richard Robbins refactor order of includes 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef NICKLIST_H
#define NICKLIST_H

#include "src/components/mode.h"
#include "src/utils/tree.h"
#include "src/utils/utils.h"

enum user_err
{
	USER_ERR_DUPLICATE = -2,
	USER_ERR_NOT_FOUND = -1,
	USER_ERR_NONE
};

struct user
{
	TREE_NODE(user) ul;
	const char *nick;
	size_t nick_len;
	struct mode prfxmodes;
	char _[];
};

struct user_list
{
	TREE_HEAD(user);
	unsigned int count;
};

enum user_err user_list_add(struct user_list*, enum casemapping_t, const char*, struct mode);
enum user_err user_list_del(struct user_list*, enum casemapping_t, const char*);
enum user_err user_list_rpl(struct user_list*, enum casemapping_t, const char*, const char*);
struct user* user_list_get(struct user_list*, enum casemapping_t, const char*, size_t);
void user_list_free(struct user_list*);

#endif