Repository navigation
Expand file tree
/
Copy pathClient.cpp
More file actions
97 lines (77 loc) · 1.58 KB
/
Copy pathClient.cpp
File metadata and controls
97 lines (77 loc) · 1.58 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "Client.hpp"
//mettre un args dans le construc parceque besoin pour le server
Client::Client(int fd) : _fd(fd), _pass(""), _nick(""), _user(""),
_buffer(""), _verif(false), _connected(false) {
}
Client::~Client() {
//normalement on close les fd
}
//setter
void Client::setUser(const std::string &user)
{
_user = user;
}
void Client::setNick(const std::string& nick)
{
_nick = nick;
}
void Client::setPass(const std::string &pass)
{
_pass = pass;
}
void Client::setVerif(bool value) {
_verif = value;
}
void Client::setConnected(bool value) {
_connected = value;
}
//getter
std::string Client::getPass() const{
return _pass;
}
std::string Client::getUser() const{
return _user;
}
std::string Client::getNick() const {
return _nick;
}
int Client::getFd() const {
return _fd;
}
std::string& Client::getBuffer() {
return _buffer;
}
bool Client::getVerif() const {
return _verif;
}
bool Client::getConnected() const {
return _connected;
}
//il ajt chaque information du client dans un buffer
void Client::appendToBuffer(const std::string& data) {
_buffer += data;
}
bool Client::operator==(const Client& user)
{
return (this->_fd == user.getFd());
}
void Client::joinChannel(Channel* channel)
{
this->_joinedChannels.push_back(channel);
}
std::vector<Channel *> Client::getJoinedChannels()
{
return(this->_joinedChannels);
}
void Client::addBuffer(std::string cmdslice)
{
this->_buffer += cmdslice;
}
std::string Client::getBuffer() const
{
return (this->_buffer);
}
void Client::setBufferEmpty()
{
this->_buffer = "";
}