Core/Chat: Rewrite some custom channel handling. Channel creation now properly saves passwords. Closes #23589.

(cherry picked from commit 8c16f318fe)
This commit is contained in:
Treeston
2019-07-13 17:44:41 +02:00
committed by Shauren
parent 71b2f8c6ab
commit ea753efb93
6 changed files with 64 additions and 35 deletions

View File

@@ -58,8 +58,23 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
return;
if (ChannelMgr* cMgr = ChannelMgr::ForTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetJoinChannel(packet.ChatChannelId, packet.ChannelName, zone))
channel->JoinChannel(GetPlayer(), packet.Password);
{
if (packet.ChatChannelId)
{ // system channel
if (Channel* channel = cMgr->GetSystemChannel(packet.ChatChannelId, zone))
channel->JoinChannel(GetPlayer());
}
else
{ // custom channel
if (Channel* channel = cMgr->GetCustomChannel(packet.ChannelName))
channel->JoinChannel(GetPlayer(), packet.Password);
else if (Channel* channel = cMgr->CreateCustomChannel(packet.ChannelName))
{
channel->SetPassword(packet.Password);
channel->JoinChannel(GetPlayer(), packet.Password);
}
}
}
}
void WorldSession::HandleLeaveChannel(WorldPackets::Channel::LeaveChannel& packet)