Client class now has getters and setters, and server has 4 functions for main loop
This commit is contained in:
@@ -18,16 +18,33 @@
|
||||
|
||||
Client::Client()
|
||||
{
|
||||
std::cout << "Client default constructor called" << std::endl;
|
||||
// std::cout << "Client default constructor called" << std::endl;
|
||||
}
|
||||
|
||||
Client::Client(int fd) : fd(fd), registered(false), authenticated(false)
|
||||
{
|
||||
std::cout << "Client will use fd: " << fd << std::endl;
|
||||
// std::cout << "Client will use fd: " << fd << std::endl;
|
||||
}
|
||||
|
||||
Client::~Client()
|
||||
{
|
||||
std::cout << "Client destructor called" << std::endl;
|
||||
// std::cout << "Client destructor called" << std::endl;
|
||||
}
|
||||
|
||||
// Getters
|
||||
int Client::getFd() const { return (this->fd); }
|
||||
std::string Client::getNick() const { return (this->nick); }
|
||||
std::string Client::getUsername() const { return (this->username); }
|
||||
std::string Client::getRealname() const { return (this->realname); }
|
||||
std::string Client::getBuffer() const { return (this->buffer); }
|
||||
bool Client::isAuthenticated() const { return (this->authenticated); }
|
||||
bool Client::isRegistered() const { return (this->registered); }
|
||||
|
||||
// Seters
|
||||
void Client::setNick(std::string nick) { this->nick = nick; }
|
||||
void Client::setUsername(std::string username) { this->username = username; }
|
||||
void Client::setRealname(std::string realname) { this->realname = realname; }
|
||||
void Client::setAuthenticated(bool value) { this->authenticated = value; }
|
||||
void Client::setRegistered(bool value) { this->authenticated = value; }
|
||||
void Client::appendBuffer(std::string data) { this->buffer += data; }
|
||||
void Client::clearBuffer() { this->buffer.clear(); }
|
||||
Reference in New Issue
Block a user