This commit is contained in:
2024-01-23 17:32:10 +01:00
parent 7023f81541
commit 839666bbbd

View File

@@ -6,13 +6,14 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */
/* Updated: 2024/01/23 17:10:16 by vvaas ### ########.fr */
/* Updated: 2024/01/23 17:23:24 by vvaas ### ########.fr */
/* */
/******************************************************************************/
#include <channel.hpp>
#include <logs.hpp>
#include <iostream>
#include <errorscode.hpp>
namespace irc
{
@@ -25,10 +26,11 @@ namespace irc
if (const_cast<unstd::SharedPtr<irc::Client>&>(*it)->getNickName() == client->getNickName())
{
logs::report(log_message, "%s is already is channel for", client->getNickName().c_str());
client->sendCode(ERR_USERONCHANNEL, "You are already in the channel");
return ;
}
}
_clients.insert(client);
logs::report(log_message, "i tried to insert %s, success : %d", client->getNickName().c_str(), _clients.insert(client).second);
for(std::set<unstd::SharedPtr<Client> >::iterator it = _clients.begin(); it != _clients.end(); ++it)
{
const_cast<unstd::SharedPtr<irc::Client>&>(*it)->sendMsg(client->getNickName(), "JOIN", _name);