This commit is contained in:
2024-01-24 00:44:09 +01:00
parent 1cf52ef8b0
commit 18f355b960
3 changed files with 18 additions and 21 deletions

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */
/* Updated: 2024/01/23 23:55:17 by vvaas ### ########.fr */
/* Updated: 2024/01/24 00:42:13 by vvaas ### ########.fr */
/* */
/******************************************************************************/
@@ -29,6 +29,18 @@ namespace irc
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);
}
void Channel::addClient(unstd::SharedPtr<Client> client, bool op)
{
if (!_clients.insert(client).second)
{
client->sendCode(ERR_USERONCHANNEL, "You are already in the channel");
return ;
}
if (op)
_operators.insert(client);
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);
}
bool Channel::removeClient(unstd::SharedPtr<Client> client)
{