forked from codewhite7777/ft_irc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChannel.hpp
61 lines (50 loc) · 1.94 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Channel.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mgo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/12 11:19:31 by mgo #+# #+# */
/* Updated: 2022/10/12 11:19:32 by mgo ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CHANNEL_HPP
# define CHANNEL_HPP
# include <string>
# include <map>
# include <list>
#include "Chatbot.hpp"
class Client;
class Channel
{
public:
Channel(std::string name);
~Channel(void);
std::size_t getCurrUserCount(void) const;
void assignAsUser(Client* clnt);
void assignAsOperator(Client* clnt);
void eraseAsUser(Client* clnt);
void eraseAsOperator(Client* clnt);
const std::string& getName(void) const;
std::string getUserListStr(void);
bool isOperator(Client* clnt);
void sendToAll(std::string msg);
void sendToOthers(Client* clnt, std::string msg);
bool isUserIn(Client* clnt);
std::list<Client*>* makeClntListInChannExceptOne(Client* clnt_to_excpt);
void eraseClntIfIs(Client* clnt);
void replaceClntKeyNick(Client* clnt, \
std::string nick_to_key);
// chatbot
ChatBot& GetChatBot();
private:
Channel(void);
std::string name_;
std::map<std::string, Client*> users_;
std::map<std::string, Client*> opers_;
std::size_t curr_user_count_;
// chatbot
ChatBot chatbot;
};
#endif