mirror of
https://github.com/Ladebeze66/ft_irc.git
synced 2025-12-17 06:28:03 +01:00
finalversionpeutetre
This commit is contained in:
parent
6d6b1d1859
commit
6da78f6457
@ -46,6 +46,27 @@ void JoinHandler::handleJoinCommand(Client* client, const std::string& params, S
|
|||||||
|
|
||||||
if (channelName[0] == '0' && channelName.size() == 1)
|
if (channelName[0] == '0' && channelName.size() == 1)
|
||||||
{
|
{
|
||||||
|
std::cout << "leave all -----------" << std::endl;
|
||||||
|
std::map<std::string, Channel *> & channels = server->getChannels();
|
||||||
|
for (std::map<std::string, Channel *>::iterator it = channels.begin(); it != channels.end(); ++it)
|
||||||
|
{
|
||||||
|
// std::cout << it->second->getName() << std::endl;
|
||||||
|
if (it->second->hasClient(client))
|
||||||
|
{
|
||||||
|
it->second->removeClient(client);
|
||||||
|
if (it->second->isEmpty())
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostringstream partMsg;
|
||||||
|
partMsg << ":" << client->getNickname() << " PART " << it->first << " Leaving" << "\r\n";
|
||||||
|
server->sendToClient(client->getFd(), partMsg.str());
|
||||||
|
|
||||||
|
it->second->broadcast(partMsg.str(), client, server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Leave all channels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user