diff --git a/Makefile b/Makefile index 65a86fc..adde70c 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: omoudni +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2025/05/02 15:40:00 by rparodi #+# #+# # -# Updated: 2025/05/22 17:35:48 by omoudni ### ########.fr # +# Updated: 2025/05/24 16:48:43 by rparodi ### ########.fr # # # #******************************************************************************# diff --git a/diagram.puml b/diagram.puml index 21e7a04..dc9e88b 100644 --- a/diagram.puml +++ b/diagram.puml @@ -55,7 +55,7 @@ class User { + getFd() : short unsigned int + isReadyToSend() : bool + isRegistered() : bool - + getNickname() : string + + getName() : string + extractFullCommand() : string + appendToReadBuffer(data : string) : void + appendToWriteBuffer(data : string) : void diff --git a/include/server.hpp b/include/server.hpp index 1b5dea3..eb674d3 100644 --- a/include/server.hpp +++ b/include/server.hpp @@ -6,7 +6,7 @@ /* By: omoudni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/20 21:50:32 by rparodi #+# #+# */ -/* Updated: 2025/05/22 18:44:35 by omoudni ### ########.fr */ +/* Updated: 2025/05/24 16:48:04 by rparodi ### ########.fr */ /* */ /******************************************************************************/ @@ -29,6 +29,8 @@ public: ~Server(); void start(); unsigned short int getPort() const; + std::list getUsersList() const; + std::list getChannelsList() const; void showInfo() const; void printUsers() const; }; diff --git a/include/user.hpp b/include/user.hpp index 4e7b326..866ca37 100644 --- a/include/user.hpp +++ b/include/user.hpp @@ -32,7 +32,7 @@ public: short unsigned int getFd() const; bool isReadyToSend() const; bool isRegistered() const; - std::string getNickname() const; + std::string getName() const; std::string extractFullCommand(); void appendToReadBuffer(const std::string &data); void appendToWriteBuffer(const std::string &data); diff --git a/sources/channel/channel.cpp b/sources/channel/channel.cpp index 0c577be..da8d51c 100644 --- a/sources/channel/channel.cpp +++ b/sources/channel/channel.cpp @@ -106,7 +106,7 @@ void Channel::addOperator(User *user) { this->_operators.push_back(user); } else { - std::cerr << user->getNickname() << " is already an operator in the channel " << this->_name << std::endl; + std::cerr << user->getName() << " is already an operator in the channel " << this->_name << std::endl; } } @@ -120,7 +120,7 @@ void Channel::addUser(User *user) { this->_users.push_back(user); } else { - std::cerr << user->getNickname() << " is already in the channel " << this->_name << std::endl; + std::cerr << user->getName() << " is already in the channel " << this->_name << std::endl; } } @@ -134,7 +134,7 @@ void Channel::removeUser(User *user) { this->_users.remove(user); } else { - std::cerr << user->getNickname() << " is not in the channel " << this->_name << std::endl; + std::cerr << user->getName() << " is not in the channel " << this->_name << std::endl; } } @@ -148,7 +148,7 @@ void Channel::removeOperator(User *user) { this->_operators.remove(user); } else { - std::cerr << user->getNickname() << " is not an operator in the channel " << this->_name << std::endl; + std::cerr << user->getName() << " is not an operator in the channel " << this->_name << std::endl; } } diff --git a/sources/user/user.cpp b/sources/user/user.cpp index 3465de6..a47b20f 100644 --- a/sources/user/user.cpp +++ b/sources/user/user.cpp @@ -21,10 +21,13 @@ short unsigned int User::getFd() const return _fd; } -// Getter for nickname -std::string User::getNickname() const -{ - return _nickname; +/** + * @brief Getter for the nickname of the user + * + * @return the actual nickname of the user + */ +std::string User::getName() const { + return this->_nickname; } void User::setUsername(const std::string &username)