Merge pull request #3 from EniumRaphael/raph

style(user): changing the getter nickname for getName()
This commit is contained in:
Raphaël 2025-05-24 18:03:53 +02:00 committed by GitHub
commit 7053dd0841
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 12 deletions

View file

@ -6,7 +6,7 @@
# By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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 #
# #
#******************************************************************************#

View file

@ -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

View file

@ -6,7 +6,7 @@
/* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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<User *> getUsersList() const;
std::list<Channel *> getChannelsList() const;
void showInfo() const;
void printUsers() const;
};

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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)