Core/Channels: Limit channel length only for custom channels

(cherry picked from commit 3fb41da57c)
This commit is contained in:
jackpoz
2020-03-15 21:40:17 +01:00
committed by Shauren
parent ee5c0e5372
commit 807df411ae

View File

@@ -65,11 +65,11 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
if (packet.Password.length() > MAX_CHANNEL_PASS_STR)
{
TC_LOG_ERROR("network", "Player %s tried to create a channel with a password more that " SZFMTD " characters long - blocked", GetPlayer()->GetGUID().ToString().c_str(), MAX_CHANNEL_PASS_STR);
TC_LOG_ERROR("network", "Player %s tried to create a channel with a password more than " SZFMTD " characters long - blocked", GetPlayer()->GetGUID().ToString().c_str(), MAX_CHANNEL_PASS_STR);
return;
}
if (!ValidateHyperlinksAndMaybeKick(packet.ChannelName))
if (!DisallowHyperlinksAndMaybeKick(packet.ChannelName))
return;
if (ChannelMgr* cMgr = ChannelMgr::ForTeam(GetPlayer()->GetTeam()))
@@ -81,6 +81,12 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
}
else
{ // custom channel
if (packet.ChannelName.length() > MAX_CHANNEL_NAME_STR)
{
TC_LOG_ERROR("network", "Player %s tried to create a channel with a name more than " SZFMTD " characters long - blocked", GetPlayer()->GetGUID().ToString().c_str(), MAX_CHANNEL_NAME_STR);
return;
}
if (Channel* channel = cMgr->GetCustomChannel(packet.ChannelName))
channel->JoinChannel(GetPlayer(), packet.Password);
else if (Channel* channel = cMgr->CreateCustomChannel(packet.ChannelName))