Merge pull request #30 from EniumRaphael/samy

🛠️ Patch Notes — ft_irc v1.4.0
This commit is contained in:
Samy BEN TAYEB 2025-06-22 19:48:28 +02:00 committed by GitHub
commit 3788f32fac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 138 additions and 46 deletions

View file

@ -6,7 +6,7 @@
# By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ # # By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2025/05/02 15:40:00 by rparodi #+# #+# # # Created: 2025/05/02 15:40:00 by rparodi #+# #+# #
# Updated: 2025/06/19 11:29:58 by rparodi ### ########.fr # # Updated: 2025/06/21 11:58:21 by rparodi ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -72,6 +72,8 @@ END = \033[0m
# All (make all) # All (make all)
all: header $(NAME) footer all: header $(NAME) footer
bonus: CPPFLAGS += -D BONUS=1
bonus: all
# Clean (make clean) # Clean (make clean)
clean: clean:
@printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n' @printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n'

18
include/bonus.hpp Normal file
View file

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bonus.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/21 12:09:57 by sben-tay #+# #+# */
/* Updated: 2025/06/21 18:55:38 by sben-tay ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef BONUS_HPP
# define BONUS_HPP
// # define BONUS 0
#endif

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 22:18:17 by rparodi #+# #+# */ /* Created: 2025/05/20 22:18:17 by rparodi #+# #+# */
/* Updated: 2025/06/19 13:42:03 by sben-tay ### ########.fr */ /* Updated: 2025/06/21 14:36:38 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -20,7 +20,7 @@
class Channel { class Channel {
public: public:
Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite); Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite);
~Channel();
// getters // getters
std::string getName() const; std::string getName() const;
std::string getTopic() const; std::string getTopic() const;
@ -47,6 +47,8 @@ class Channel {
bool isInvited(User *user) const; bool isInvited(User *user) const;
void removeUser(User *user); void removeUser(User *user);
void removeOperator(User *user); void removeOperator(User *user);
void setBotChannel(bool isBot);
bool getBotChannel() const;
// utility functions // utility functions
void sendAllClientInAChannel(const std::string &toSend, User *exclude = NULL); void sendAllClientInAChannel(const std::string &toSend, User *exclude = NULL);
@ -62,6 +64,7 @@ class Channel {
std::list<User *> _operators; std::list<User *> _operators;
std::list<User *> _users; std::list<User *> _users;
std::list<User *> _invited; std::list<User *> _invited;
bool _botChannel;
}; };

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 23:31:58 by rparodi #+# #+# */ /* Created: 2025/05/20 23:31:58 by rparodi #+# #+# */
/* Updated: 2025/06/19 13:00:30 by rparodi ### ########.fr */ /* Updated: 2025/06/21 17:53:03 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,14 +6,14 @@
/* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */ /* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/12 14:16:03 by rparodi #+# #+# */ /* Created: 2025/05/12 14:16:03 by rparodi #+# #+# */
/* Updated: 2025/06/05 11:10:45 by rparodi ### ########.fr */ /* Updated: 2025/06/21 11:59:02 by rparodi ### ########.fr */
/* */ /* */
/******************************************************************************/ /******************************************************************************/
#pragma once #pragma once
#ifdef DEBUG #ifndef BONUS
#define LOG std::endl << CLR_CYAN << "Debug: " << __FILE__ << ":" << __LINE__ << std::endl << CLR_RESET #define BONUS 0
#endif #endif
enum e_code { enum e_code {

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */ /* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */
/* Updated: 2025/06/20 19:17:53 by sben-tay ### ########.fr */ /* Updated: 2025/06/21 14:38:06 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,6 +15,7 @@
#include <string> #include <string>
#include "PollManager.hpp" #include "PollManager.hpp"
class User class User
{ {
private: private:
@ -38,6 +39,7 @@ class User
public: public:
User(short unsigned fd, PollManager& poll); User(short unsigned fd, PollManager& poll);
User( void ); // default constructor for bot service
short unsigned int getFd() const; short unsigned int getFd() const;
void appendToReadBuffer(const std::string &data); void appendToReadBuffer(const std::string &data);
void appendToWriteBuffer(const std::string &data); void appendToWriteBuffer(const std::string &data);
@ -61,10 +63,11 @@ class User
const std::string getRealname(void) const; const std::string getRealname(void) const;
const std::string getNickname() const; const std::string getNickname() const;
const std::string getWriteBuffer() const; const std::string getWriteBuffer() const;
const std::string& getHostname() const; const std::string getHostname() const;
const std::string& getIpAddress() const; const std::string getIpAddress() const;
const std::string getName() const; const std::string getName() const;
const std::string getPrefix() const; const std::string getPrefix() const;
const std::string getReadBuffer() const;
bool hasDataToSend() const; bool hasDataToSend() const;
bool getHasPass() const; bool getHasPass() const;

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 22:43:24 by rparodi #+# #+# */ /* Created: 2025/05/20 22:43:24 by rparodi #+# #+# */
/* Updated: 2025/06/19 13:58:39 by rparodi ### ########.fr */ /* Updated: 2025/06/21 19:04:34 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,10 +16,25 @@
Channel::Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite) : _name(name), _owner(owner), _maxUsers(maxUsers), _needInvite(needInvite) { Channel::Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite) : _name(name), _owner(owner), _maxUsers(maxUsers), _needInvite(needInvite) {
this->_protectTopic = false; this->_protectTopic = false;
if (BONUS)
this->_botChannel = true;
else
this->_botChannel = false;
this->_maxUsers = ~0; this->_maxUsers = ~0;
this->_topic = ""; this->_topic = "";
} }
Channel::~Channel() {
for (std::list<User *>::iterator it = _users.begin(); it != _users.end(); ++it) {
if (*it != _owner) {
delete *it;
}
}
_users.clear();
_operators.clear();
_invited.clear();
}
/** /**
* @brief Get the name of the channel * @brief Get the name of the channel
* *
@ -258,3 +273,7 @@ bool Channel::isInvited(User *user) const {
std::cerr << user->getName() << " is not invited to the channel " << this->_name << std::endl; std::cerr << user->getName() << " is not invited to the channel " << this->_name << std::endl;
return false; return false;
} }
void Channel::setBotChannel(bool isBot) { _botChannel = isBot; }
bool Channel::getBotChannel() const { return _botChannel; }

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */ /* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
/* Updated: 2025/06/19 02:27:50 by sben-tay ### ########.fr */ /* Updated: 2025/06/21 18:51:55 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,6 +14,7 @@
#include "commands.hpp" #include "commands.hpp"
#include "logs.hpp" #include "logs.hpp"
#include <list> #include <list>
#include "bonus.hpp"
using namespace cmd; using namespace cmd;
@ -65,7 +66,13 @@ void Join::execute() {
for (std::list<User *>::iterator it = _cTarget->getUsers().begin(); it != _cTarget->getUsers().end(); ++it) { for (std::list<User *>::iterator it = _cTarget->getUsers().begin(); it != _cTarget->getUsers().end(); ++it) {
msg353 += (*it)->getNickname() + " "; msg353 += (*it)->getNickname() + " ";
} }
_sender->appendToWriteBuffer(msgJoin + msg332 + msg353 + "\r\n"); if (BONUS) {
_cTarget->setBotChannel(true);
std::string msgJoinBot = ":bot!ircbot@localhost JOIN #" + _cTarget->getName() + "\r\n";
_sender->appendToWriteBuffer(msgJoinBot + msgJoin + msg332 + msg353 + "\r\n");
}
else
_sender->appendToWriteBuffer(msgJoin + msg332 + msg353 + "\r\n");
return; return;
} }

View file

@ -6,13 +6,14 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */ /* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
/* Updated: 2025/06/20 17:01:49 by rparodi ### ########.fr */ /* Updated: 2025/06/22 19:38:09 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "kick.hpp" #include "kick.hpp"
#include "commands.hpp" #include "commands.hpp"
#include "logs.hpp" #include "logs.hpp"
#include "bonus.hpp"
using namespace cmd; using namespace cmd;
@ -26,53 +27,68 @@ e_code Kick::checkArgs() {
WARNING_MSG("Invalid channel name for KICK command"); WARNING_MSG("Invalid channel name for KICK command");
INFO_MSG("Channel names must start with a '#' character"); INFO_MSG("Channel names must start with a '#' character");
return ERR_NOSUCHCHANNEL; return ERR_NOSUCHCHANNEL;
} else }
_args.at(1).erase(0, 1); _args.at(1).erase(0, 1); // On enlève le '#' pour chercher le nom réel
_cTarget = searchList(this->_server->getChannelsList(), _args.at(1)); _cTarget = searchList(this->_server->getChannelsList(), _args.at(1));
if (_cTarget == NULL) { if (_cTarget == NULL) {
WARNING_MSG("Channel not found for KICK command"); WARNING_MSG("Channel not found for KICK command");
INFO_MSG("You can only KICK users to channels you are in");
return ERR_NOSUCHCHANNEL; return ERR_NOSUCHCHANNEL;
} else }
_args.at(1).erase(0, 1);
if (searchList(_cTarget->getOperators(), _sender->getName()) == NULL) { if (searchList(_cTarget->getOperators(), _sender->getName()) == NULL) {
WARNING_MSG("You are not an operator in the channel for KICK command"); WARNING_MSG("You are not an operator in the channel for KICK command");
return ERR_CHANOPRIVSNEEDED; return ERR_CHANOPRIVSNEEDED;
} }
if (BONUS && _args.at(2) == "bot" && _cTarget->getBotChannel()) {
return _PARSING_OK;
}
_uTarget = searchList(this->_users, _args.at(2)); _uTarget = searchList(this->_users, _args.at(2));
if (this->_uTarget == NULL) { if (_uTarget == NULL || !_uTarget->isRegistered()) {
WARNING_MSG("User not found"); WARNING_MSG("User not found or not registered");
return ERR_NOSUCHNICK; return ERR_NOSUCHNICK;
} }
if (this->_uTarget->isRegistered() == false) { if (searchList(this->_cTarget->getUsers(), _uTarget->getName()) == NULL) {
WARNING_MSG("User is not registered for KICK command"); WARNING_MSG("User is not in the channel for KICK command");
INFO_MSG("You can only KICK registered users"); return ERR_USERNOTINCHANNEL;
return ERR_NOSUCHNICK;
}
if (searchList(this->_cTarget->getUsers(), this->_uTarget->getName()) == NULL) {
WARNING_MSG("User is already in the channel for KICK command");
INFO_MSG("You cannot KICK a user who is already in the channel");
return ERR_USERONCHANNEL;
} }
return _PARSING_OK; return _PARSING_OK;
} }
/** /**
* @brief Execute the kick command * @brief Execute the KICK command
* @note To kick a user from a channel * @note Operator removes a user from a channel
*/ */
void Kick::execute() { void Kick::execute() {
if (checkArgs() != _PARSING_OK) { if (checkArgs() != _PARSING_OK) {
ERROR_MSG("Invalid arguments for INVITE command (see warning message)"); ERROR_MSG("Invalid arguments for KICK command (see warning message)");
return; return;
} }
if (BONUS && _args.at(2) == "bot") {
if (_cTarget->getBotChannel()) {
std::string msgKickBot = ":bot!ircbot@localhost KICK #" + _cTarget->getName() + " " + "bot";
if (_args.size() > 4)
msgKickBot += " :" + _args.at(3);
msgKickBot += "\r\n";
std::cout << " msgKickBot: " << msgKickBot << std::endl;
_cTarget->sendAllClientInAChannel(msgKickBot);
_cTarget->setBotChannel(false);
}
return;
}
std::string msgPart = ":" + this->_uTarget->getPrefix() + " PART #" + _cTarget->getName() + "\r\n"; std::string msgPart = ":" + this->_uTarget->getPrefix() + " PART #" + _cTarget->getName() + "\r\n";
std::string msgKick = ":" + this->_uTarget->getPrefix() + " KICK #" + this->_cTarget->getName(); std::string msgKick = ":" + this->_uTarget->getPrefix() + " KICK #" + this->_cTarget->getName();
if (_args.size() > 4) if (_args.size() > 4)
msgKick += " :" + _args.at(4); msgKick += " :" + _args.at(4);
msgKick += "\r\n"; msgKick += "\r\n";
this->_uTarget->appendToWriteBuffer(msgKick + msgPart); std::cout << " msgKick: " << msgKick << "msgPart: " << msgPart << std::endl;
_cTarget->sendAllClientInAChannel(msgKick);
_uTarget->appendToWriteBuffer(msgPart);
_cTarget->removeUser(this->_uTarget); _cTarget->removeUser(this->_uTarget);
_cTarget->removeOperator(this->_uTarget); _cTarget->removeOperator(this->_uTarget);

View file

@ -6,13 +6,14 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */ /* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
/* Updated: 2025/06/19 02:28:16 by sben-tay ### ########.fr */ /* Updated: 2025/06/22 01:53:33 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "privmsg.hpp" #include "privmsg.hpp"
#include "commands.hpp" #include "commands.hpp"
#include "logs.hpp" #include "logs.hpp"
#include "bonus.hpp"
using namespace cmd; using namespace cmd;
@ -61,12 +62,33 @@ void PrivMsg::execute() {
std::string content = _args.at(2); std::string content = _args.at(2);
std::string msg = ":" + _sender->getPrefix() + " PRIVMSG " + target + " :" + content + "\r\n"; std::string msg = ":" + _sender->getPrefix() + " PRIVMSG " + target + " :" + content + "\r\n";
//bonus msgBot
std::string msgBot = ":bot!ircbot@localhost PRIVMSG " + target + " :📜 Liste des commandes disponibles :\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- JOIN #channel → Rejoindre un canal\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- PART #channel → Quitter un canal\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- PRIVMSG <cible> msg → Envoyer un message\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- TOPIC #channel :txt → Voir / modifier le topic\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- MODE #channel +o nick → Ajouter un opérateur\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- INVITE nick #channel → Inviter un utilisateur\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- KICK #channel nick → Éjecter un utilisateur\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- WHO / WHOIS → Infos sur les utilisateurs\r\n";
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- !help → Affiche cette aide\r\n";
// Envoi vers un channel // Envoi vers un channel
if (target[0] == '#') { if (target[0] == '#') {
target.erase(0, 1); target.erase(0, 1);
if (_cTarget) if (_cTarget)
_cTarget->sendAllClientInAChannel(msg, _sender); // Optionnel: évite d'envoyer au sender _cTarget->sendAllClientInAChannel(msg, _sender);
if (BONUS && _cTarget->getBotChannel()) {
if (_args.at(2) == "!help") {
std::cout << "BONUS: PING command received, sending PONG" << std::endl;
_cTarget->sendAllClientInAChannel(msgBot);
}
}
} }
// Envoi vers un user // Envoi vers un user
else { else {
if (_uTarget) if (_uTarget)

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */ /* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
/* Updated: 2025/06/20 17:55:27 by sben-tay ### ########.fr */ /* Updated: 2025/06/21 14:30:19 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -55,10 +55,10 @@ void Topic::execute() {
if (this->_args.size() == 1) { if (this->_args.size() == 1) {
if (this->_cTarget->getTopic().empty()) { if (this->_cTarget->getTopic().empty()) {
std::string msg331 = ":localhost 331 " + this->_sender->getNickname() + " " + this->_cTarget->getName() + " :No topic is set\r\n"; std::string msg331 = ":localhost 331 " + this->_sender->getNickname() + " #" + this->_cTarget->getName() + " :No topic is set\r\n";
this->_sender->appendToWriteBuffer(msg331); this->_sender->appendToWriteBuffer(msg331);
} else { } else {
std::string msg332 = ":localhost 332 " + this->_sender->getNickname() + " " + this->_cTarget->getName() + " :" + this->_cTarget->getTopic() + "\r\n"; std::string msg332 = ":localhost 332 " + this->_sender->getNickname() + " #" + this->_cTarget->getName() + " :" + this->_cTarget->getTopic() + "\r\n";
this->_sender->appendToWriteBuffer(msg332); this->_sender->appendToWriteBuffer(msg332);
} }
} else { } else {
@ -70,7 +70,7 @@ void Topic::execute() {
} }
this->_cTarget->setTopic(newTopic); this->_cTarget->setTopic(newTopic);
std::string topicMsg = ":" + this->_sender->getPrefix() + " TOPIC " + this->_cTarget->getName() + " :" + newTopic + "\r\n"; std::string topicMsg = ":" + this->_sender->getPrefix() + " TOPIC #" + this->_cTarget->getName() + " :" + newTopic + "\r\n";
this->_cTarget->sendAllClientInAChannel(topicMsg); this->_cTarget->sendAllClientInAChannel(topicMsg);
} }
} }

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* check.cpp :+: :+: :+: */ /* check.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/13 11:25:04 by rparodi #+# #+# */ /* Created: 2025/05/13 11:25:04 by rparodi #+# #+# */
/* Updated: 2025/05/13 14:20:47 by rparodi ### ########.fr */ /* Updated: 2025/06/21 18:49:43 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/21 20:37:12 by omoudni #+# #+# */ /* Created: 2025/05/21 20:37:12 by omoudni #+# #+# */
/* Updated: 2025/06/20 19:18:27 by sben-tay ### ########.fr */ /* Updated: 2025/06/21 14:38:31 by sben-tay ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -163,9 +163,11 @@ const std::string User::getPrefix() const { return _nickname + "!" + _username +
const std::string User::getUsername() const { return _username; } const std::string User::getUsername() const { return _username; }
const std::string& User::getHostname() const { return _hostname; } const std::string User::getHostname() const { return _hostname; }
const std::string& User::getIpAddress() const { return _ipAdress; } const std::string User::getIpAddress() const { return _ipAdress; }
const std::string User::getReadBuffer() const { return _read_buffer; }
void User::setHostname(const std::string &hostname) { _hostname = hostname; } void User::setHostname(const std::string &hostname) { _hostname = hostname; }