~rcr/rirc

ref: 7ca2a99a605b7e0b88fa85bc43a8fadc13695ba8 rirc/src/components/channel.h -rw-r--r-- 1.5 KiB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef CHANNEL_H
#define CHANNEL_H

#include "src/components/buffer.h"
#include "src/components/input.h"
#include "src/components/mode.h"
#include "src/components/user.h"

/* Channel activity types, in order of precedence */
enum activity_t
{
	ACTIVITY_DEFAULT, /* Default activity */
	ACTIVITY_JPQ,     /* Join/Part/Quit activity */
	ACTIVITY_ACTIVE,  /* Chat activity */
	ACTIVITY_PINGED,  /* Ping activity */
	ACTIVITY_T_SIZE
};

enum channel_t
{
	CHANNEL_T_INVALID,
	CHANNEL_T_OTHER,   /* Default/all other buffers */
	CHANNEL_T_CHANNEL, /* Channel message buffer */
	CHANNEL_T_SERVER,  /* Server message buffer */
	CHANNEL_T_PRIVATE, /* Private message buffer */
	CHANNEL_T_SIZE
};

struct channel
{
	const char *name;
	enum activity_t activity;
	enum channel_t type;
	size_t name_len;
	struct buffer buffer;
	struct channel *next;
	struct channel *prev;
	struct input input;
	struct mode chanmodes;
	struct mode_str chanmodes_str;
	struct server *server;
	struct user_list users;
	unsigned int parted : 1;
	unsigned int joined : 1;
	char _[];
};

struct channel_list
{
	struct channel *head;
	struct channel *tail;
};

struct channel* channel(const char*, enum channel_t);
struct channel* channel_list_get(struct channel_list*, const char*, enum casemapping_t);
void channel_free(struct channel*);
void channel_list_add(struct channel_list*, struct channel*);
void channel_list_del(struct channel_list*, struct channel*);
void channel_list_free(struct channel_list*);
void channel_part(struct channel*);
void channel_reset(struct channel*);

#endif