Core/Channel: properly notify client about invalid channel names

Closes #16190
This commit is contained in:
ariel-
2018-02-05 13:45:52 -03:00
parent 4bd2d28119
commit 650a92dc9f
2 changed files with 7 additions and 5 deletions

View File

@@ -16,8 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Channel.h"
#include "ChannelMgr.h"
#include "Channel.h"
#include "DBCStores.h"
#include "Player.h"
#include "World.h"

View File

@@ -49,11 +49,13 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
return;
}
if (channelName.empty())
return;
if (isdigit(channelName[0]))
if (channelName.empty() || isdigit(channelName[0]))
{
WorldPacket data(SMSG_CHANNEL_NOTIFY, 1 + channelName.size());
data << uint8(CHAT_INVALID_NAME_NOTICE) << channelName;
SendPacket(&data);
return;
}
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetJoinChannel(channelId, channelName, zone))