-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChannel.hpp
71 lines (55 loc) · 1.45 KB
/
Channel.hpp
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
#ifndef CHANNEL_HPP
#define CHANNEL_HPP
#include <map>
#include <set>
#include <vector>
#include <sstream>
#include "Client.hpp"
#define CHAN_MEM 0
#define CHAN_OPR 1
class Channel
{
private:
std::string _name;
std::string _topic;
std::string _key; // 비밀번호
int _limit; // 최대 인원 수
bool _invite_only; // 초대만 가능
bool _topic_only; // 토픽 권한
time_t _created;
time_t _topic_created;
std::string _topic_author;
std::map<int, int> _clients; // fd, operator
std::set<int> _invited; // 초대된 인원
Channel();
public:
Channel(std::string const &name);
~Channel();
void setName(std::string const &name);
void setKey(std::string const &key);
void setLimit(int limit);
void setInviteOnly(bool inviteOnly);
void setTopicOnly(bool inviteOnly);
void setTopic(std::string const &topic, std::string author);
void inviteClient(int fd);
void delInvitedClient(int fd);
void addClient(int fd, int chanops);
void delClient(int fd);
void addOperator(int fd);
void delOperator(int fd);
size_t getClientNum();
std::string const &getName() const;
std::string const &getTopic() const;
std::string const &getKey() const;
int getLimit() const;
bool getInviteOnly() const;
bool getTopicOnly() const;
std::map<int, int> &getClients();
std::vector<int> getClientsFd();
std::string getModeList();
std::string getCreated();
std::string getTopicCreated();
std::string getTopicAuthor();
int isInvited(int fd);
};
#endif