50 lines
2.2 KiB
C++
50 lines
2.2 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Client.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2026/04/13 22:31:44 by aortigos #+# #+# */
|
|
/* Updated: 2026/04/13 22:31:44 by aortigos ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "Client.hpp"
|
|
|
|
//////////////////
|
|
// Constructors //
|
|
//////////////////
|
|
|
|
Client::Client()
|
|
{
|
|
// 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;
|
|
}
|
|
|
|
Client::~Client()
|
|
{
|
|
// 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(); } |