Improving commands and added quit

This commit is contained in:
aortigos
2026-05-16 11:47:45 +02:00
parent 3de8940560
commit 66bd57bfde
9 changed files with 108 additions and 11 deletions

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/10 22:06:22 by aortigos #+# #+# */
/* Updated: 2026/05/15 23:04:35 by aortigos ### ########.fr */
/* Updated: 2026/05/16 11:12:12 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,9 +46,14 @@ void Server::nick_cmd(User &client, std::istringstream &ss)
if (client.isRegistered())
{
// Change nick to an already registered user
// Send message to his channels
//client.broadcast(":" + oldNick + "!~" + client.getUsername() + "@hostt NICK " + args + "\r\n");
std::string msg = ":" + oldNick + " NICK " + args + "\r\n";
const std::set<std::string> &userChannels = client.getChannels();
for (std::set<std::string>::const_iterator it = userChannels.begin(); it != userChannels.end(); it++)
{
std::map<std::string, Channel>::iterator ch = channels_.find(*it);
if (ch != channels_.end())
ch->second.broadcast(msg, clients_, -1);
}
return ;
}