From e742988ca7ed3fe2e829295c4d2d3f405b9e2e4e Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 24 May 2025 17:59:18 +0200 Subject: [PATCH] style(user): changing the getter nickname for getName() --- Makefile | 2 +- diagram.puml | 2 +- include/server.hpp | 7 ++++++- include/user.hpp | 2 +- sources/channel/channel.cpp | 8 ++++---- sources/user/user.cpp | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 3ad7c51..48edd22 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: sben-tay +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2025/05/02 15:40:00 by rparodi #+# #+# # -# Updated: 2025/05/21 13:01:09 by rparodi ### ########.fr # +# Updated: 2025/05/24 16:48:43 by rparodi ### ########.fr # # # # **************************************************************************** # diff --git a/diagram.puml b/diagram.puml index 05ae631..9c966d4 100644 --- a/diagram.puml +++ b/diagram.puml @@ -48,7 +48,7 @@ class User { - _registered : bool + getFd() : int - + getNickname() : string + + getName() : string + setNickname(name : string) : void + appendToReadBuffer(data : string) : void + appendToWriteBuffer(data : string) : void diff --git a/include/server.hpp b/include/server.hpp index 96a78b0..57a0d00 100644 --- a/include/server.hpp +++ b/include/server.hpp @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/20 21:50:32 by rparodi #+# #+# */ -/* Updated: 2025/05/21 13:03:01 by rparodi ### ########.fr */ +/* Updated: 2025/05/24 16:48:04 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,9 @@ #include #include "PollManager.hpp" +#include +#include "user.hpp" +#include "channel.hpp" class Server { private: @@ -25,6 +28,8 @@ class Server { Server(int port, const std::string &password); ~Server(); void start(); + std::list getUsersList() const; + std::list getChannelsList() const; unsigned short int getPort() const; void showInfo() const; }; diff --git a/include/user.hpp b/include/user.hpp index b40bfee..d62366f 100644 --- a/include/user.hpp +++ b/include/user.hpp @@ -28,7 +28,7 @@ class User { 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 80e1adb..ed1f862 100644 --- a/sources/user/user.cpp +++ b/sources/user/user.cpp @@ -26,7 +26,7 @@ int User::getFd() const { * * @return the actual nickname of the user */ -std::string User::getNickname() const { +std::string User::getName() const { return this->_nickname; }