Skip to content

Commit

Permalink
hotfix: topic issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzafa8 committed May 5, 2024
1 parent 568baba commit eb8bc87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ std::vector<User *> Channel::getOperators() const {
std::vector<User *> Channel::getAllUsers() const {
std::vector<User *> allUsers = this->_operators;
allUsers.insert(allUsers.end(), this->_users.begin(), this->_users.end());
for (size_t i = 0; i < allUsers.size(); i++) {
std::cout << allUsers[i]->getFd() << std::endl;
std::cout << allUsers[i]->getNickname() << std::endl;
}
return allUsers;
}

Expand Down
6 changes: 4 additions & 2 deletions src/commands/TopicCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ void TopicCommand::execute(int clientFd) {
)
);
} else {
const std::string &message = _topic.empty() ? NoTopicResponse(nickname, channelName).getReply()
: TopicResponse(nickname, channelName, _topic).getReply();
const std::string &channelTopic = _channel->getTopic();
const std::string &message = channelTopic.empty()
? NoTopicResponse(nickname, channelName).getReply()
: TopicResponse(nickname, channelName, channelTopic).getReply();
Logger::debug("Sending topic to user " + nickname);
server.sendMessage(clientFd, message);
}
Expand Down

0 comments on commit eb8bc87

Please sign in to comment.