-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChannel.hpp
More file actions
66 lines (52 loc) · 1.21 KB
/
Channel.hpp
File metadata and controls
66 lines (52 loc) · 1.21 KB
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
64
65
66
#pragma once
#include "IRCserver.hpp"
class Channel;
class User;
class Server;
enum
{
MODE_INVITEONLY = 1 << 0,
MODE_TOPIC = 1 << 1,
MODE_KEY = 1 << 2,
MODE_OPERATOR = 1 << 3,
MODE_LIMIT = 1 << 4
};
class Channel
{
private:
std::string name;
std::string key;
std::string topic;
int mode;
size_t limit;
UserList users;
UserList operators;
UserList invited;
public:
Channel();
Channel(const std::string &n, const std::string &k, const std::string &t);
const std::string &get_name();
void set_name(const std::string &n);
const std::string &get_key();
void set_key(const std::string &k);
const std::string &get_topic();
void set_topic(const std::string &t);
int get_mode();
void set_mode(int mode);
size_t get_limit();
bool has_mode(int mode);
void set_limit(size_t limit);
int add_user(int fd, User *user, const std::string &key);
bool has_user(int fd);
void remove_user(int fd);
UserList &get_users();
std::string get_users_list();
std::string get_users_count();
std::vector<std::string> get_who_list();
int add_operator(User *user);
bool is_operator(User *user);
void remove_operator(User *user);
void invite(User *user);
bool is_invited(User *user);
void remove_invite(User *user);
};