error msg

This commit is contained in:
mochaoui
2024-04-20 12:32:04 -05:00
parent c47db99b7f
commit 8711ebaac1

View File

@@ -820,6 +820,12 @@ void Server::handleClientData(int fd) {
std::string modeMessage = ":" + channels[channelName].getNickname(fd) + " MODE #" + channelName + " +o " + nick + "\n";
send(fd, modeMessage.c_str(), modeMessage.length(), 0);
}
else
{
std::string errorMessage = ":" + channels[channelName].getNickname(fd) + " PRIVMSG #" + channelName + " :Error: You are not authorized to execute this command " + "\r\n";
send(fd, errorMessage.c_str(), errorMessage.size(), 0);
}
}
else if (mode == "-o")
{
@@ -828,10 +834,15 @@ void Server::handleClientData(int fd) {
std::string modeMessage = ":" + channels[channelName].getNickname(fd) + " MODE #" + channelName + " -o " + nick + "\n";
send(fd, modeMessage.c_str(), modeMessage.length(), 0);
}
else
{
std::string errorMessage = ":" + channels[channelName].getNickname(fd) + " PRIVMSG #" + channelName + " :Error: You are not authorized to execute this command " + "\r\n";
send(fd, errorMessage.c_str(), errorMessage.size(), 0);
}
}
// else if (mode == "-i")
// {
// }
}