Skip to content

Commit

Permalink
Merge branch 'hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
siliotar committed Dec 3, 2021
2 parents d1867d0 + e4bdcf8 commit 382bdb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions srcs/commands/channelCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ int Server::kickCmd(const Message &msg, User &user)
sendError(user, ERR_NOTONCHANNEL, msg.getParams()[0]);
else if (!containsNickname(msg.getParams()[1]))
sendError(user, ERR_NOSUCHNICK, msg.getParams()[1]);
else if (!channels.at(msg.getParams()[0])->containsNickname(msg.getParams()[1]))
sendError(user, ERR_USERNOTINCHANNEL, msg.getParams()[1], msg.getParams()[0]);
else
{
Channel *chan = channels.at(msg.getParams()[0]);
Expand All @@ -305,22 +307,20 @@ int Server::partCmd(const Message &msg, User &user)
else
{
std::queue<std::string> chans = split(msg.getParams()[0], ',', false);
std::vector<std::string> chansInVector;
while (chans.size() > 0)
{
if (!containsChannel(chans.front()))
return sendError(user, ERR_NOSUCHCHANNEL, chans.front());
if (!user.isOnChannel(chans.front()))
return sendError(user, ERR_NOTONCHANNEL, chans.front());
chansInVector.push_back(chans.front());
sendError(user, ERR_NOSUCHCHANNEL, chans.front());
else if (!user.isOnChannel(chans.front()))
sendError(user, ERR_NOTONCHANNEL, chans.front());
else
{
channels.at(chans.front())->sendMessage("PART " + chans.front() + "\n", user, true);
channels.at(chans.front())->disconnect(user);
user.removeChannel(chans.front());
}
chans.pop();
}
for (size_t i = 0; i < chansInVector.size(); ++i)
{
channels.at(chansInVector[i])->sendMessage("PART " + chansInVector[i] + "\n", user, true);
channels.at(chansInVector[i])->disconnect(user);
user.removeChannel(chansInVector[i]);
}
}
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion srcs/commands/ircOperatorCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ int Server::restartCmd(const Message &msg, User &user) {
// Start listening.
listenSocket();
return 0;
}
}

0 comments on commit 382bdb7

Please sign in to comment.