Skip to content

Commit

Permalink
refactor: apply PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzafa8 committed Mar 28, 2024
1 parent a5f698b commit 9436628
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions includes/libsUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
# define USER_NOT_FOUND_ERR "[ERROR] User not found in list."
# define CHANNEL_ALREADY_ADDED_ERR "[ERROR] Channel already added."

# define INVITE_CMD_RESPONSE(nickname, channelName) nickname + " " + channelName

std::string trim(const std::string& str);
std::vector<std::string> split(const std::string &s, char delim);

Expand Down
7 changes: 4 additions & 3 deletions src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ bool Server::isNicknameInUse(const std::string& nickname) const {
* This function aims to get all the user information searching by the nickname.
*
* @param nickname The nickname of the user.
* @return The user object with all its information.
*
* @throws `ServerException` if the user is not found.
*
* @return The user object with all its information.
*/
User &Server::getUserByNickname(const std::string &nickname) {
std::vector<User>::iterator it = this->findUserByNickname(nickname);
Expand Down Expand Up @@ -433,9 +434,9 @@ void Server::removeChannel(std::string channelName) {
*
* @param channelName The name of the channel.
*
* @return The channel with the name.
*
* @throws `ServerException` if the channel is not found.
*
* @return The channel with the name.
*/
Channel &Server::getChannelByName(const std::string &channelName) {
std::vector<Channel>::iterator it = findChannel(channelName);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/InviteCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ void InviteCommand::execute(int clientFd) {
if (channel.getModes() == "i" && !channel.isOper(me.getNickname()))
throw ChanOPrivsNeededException(this->_channelName);
channel.inviteUser(this->_nickname);
server.sendMessage(clientFd, this->_nickname + " " + this->_channelName);
server.sendMessage(clientFd, INVITE_CMD_RESPONSE(this->_nickname, this->_channelName));
}

0 comments on commit 9436628

Please sign in to comment.