-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChannel.hpp
More file actions
75 lines (56 loc) · 2.01 KB
/
Channel.hpp
File metadata and controls
75 lines (56 loc) · 2.01 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
67
68
69
70
71
72
73
74
75
// In Channel.hpp
#ifndef CHANNEL_HPP
#define CHANNEL_HPP
#include "Client.hpp"
#include "Irc.hpp"
class Channel
{
private:
std::string _name;
std::map<int, std::vector<std::string> > _clients;
std::string _topic;
std::string _pass;
std::vector<int> _allowedClients;
std::set<int> _operators;
bool _inviteOnly;
bool _topicRestricted;
size_t _userLimit;
bool _hasUserLimit;
public:
Channel();
Channel(const std::string& name);
void setName(std::string name);
void setTopic(std::string topic);
void setAllowedClient(int clientFd);
void setPass(std::string pass);
void removePass();
const std::string& getName();
const std::string& getTopic();
const std::map<int, std::vector<std::string> >& getClients() const;
const std::vector<int>& getAllowedClients() const;
void removeClient(int client_fd);
void addClient(int client_fd);
void revokePermissions(int client_fd);
bool isOperator(int client_fd) const;
// Mode +o (operator)
void addOperator(int client_fd);
void removeOperator(int client_fd);
bool isPasswordProtected() const;
const std::string& getPass() const;
// Mode +i (invite-only)
bool isInviteOnly() const;
void setInviteOnly(bool value);
// Mode +t (topic restriction)
bool isTopicRestricted() const;
void setTopicRestricted(bool value);
// Mode +l (user limit)
bool hasUserLimit() const;
size_t getUserLimit() const;
void setUserLimit(size_t limit);
void removeUserLimit();
int canJoin(int client_fd, const std::string &pass) const;
bool hasClient(int client_fd) const;
std::string getModeString() const;
bool isUserInChannel(int client_fd) const;
};
#endif // CHANNEL_HPP