-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChannel.hpp
83 lines (68 loc) · 2.11 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
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#define MAX_NAME_LENGTH 50
#define MAX_USER_LIMIT 10
#define MAX_CHANNEL_LIMIT 10
#include "Server.hpp"
#include "Client.hpp"
class Server;
class Client;
class Channel
{
private:
size_t _limit;
std::string _name;
std::string _mode;
std::string _topic;
std::string _key;
bool _hastopic;
bool _haskey;
long _creationtime;
std::vector<Client *> _clients;
std::vector<Client *> _invited;
std::vector<Client *> _operators;
Client *_topic_setter;
long _topic_time;
public:
Channel();
Channel(std::string name);
Channel(std::string name, std::string mode , std::string topic, std::string key, Client *creator);
virtual ~Channel();
/* GETTERS */
size_t GetLimit();
std::string const &GetName() const;
std::string const &GetMode() const;
std::string const &GetTopic() const;
std::string const &GetKey() const;
std::vector<Client *> GetClients();
size_t GetClientCount();
bool const &HasTopic() const;
bool const &HasKey() const;
std::string const GetCreationTime() const;
std::string GetTopicSetAt() const;
std::string GetTopicSetBy() const;
std::string GetClientByNick(std::string nick);
/* SETTERS */
void SetTopic(std::string &topic, Client *setter);
void UnsetTopic(Client *setter);
void SetKey(std::string &key);
void UnsetKey();
void SetMode(std::string &mode);
void SetLimit(size_t limit);
void SetInviteOnly(bool set);
void SetOpsChangeTopic(bool set);
/* CHECKERS */
int IsChannelOperator(Client *client);
bool IsInvited(Client *client);
bool IsInviteOnly();
bool IsInChannel(Client *client);
bool IsTopicChangable();
/* METHODS */
void RemoveUser(Client *client);
bool AddOperator(std::string nick);
bool RemoveOperator(std::string nick);
void RemoveInvited(Client *client);
void AddUser(Client *client);
void InviteUser(Client *client);
void SendChannelMessage(std::string message);
std::string GetUsersList();
};