[12757] Chat commands disabled for normal players.

A new setting for the world server has been added. From now on
chat commands executed by normal player accounts will no longer
be executed, unless you explicitly enable the `PlayerCommands`
option.

By default player command execution is disabled.

commit is based on 208599f7fa
This commit is contained in:
sanctum32 2013-12-29 23:05:34 +02:00 committed by Antz
parent d18fc38034
commit ab98672241
6 changed files with 16 additions and 7 deletions

View file

@ -1335,12 +1335,12 @@ bool ChatHandler::ParseCommands(const char* text)
MANGOS_ASSERT(text); MANGOS_ASSERT(text);
MANGOS_ASSERT(*text); MANGOS_ASSERT(*text);
// if(m_session->GetSecurity() == SEC_PLAYER)
// return false;
/// chat case (.command or !command format) /// chat case (.command or !command format)
if (m_session) if (m_session)
{ {
if (m_session->GetSecurity() == SEC_PLAYER && !sWorld.getConfig(CONFIG_BOOL_PLAYER_COMMANDS))
return false;
if (text[0] != '!' && text[0] != '.') if (text[0] != '!' && text[0] != '.')
return false; return false;

View file

@ -789,6 +789,8 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET, "Network.KickOnBadPacket", false); setConfig(CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET, "Network.KickOnBadPacket", false);
setConfig(CONFIG_BOOL_PLAYER_COMMANDS, "PlayerCommands", false);
if (int clientCacheId = sConfig.GetIntDefault("ClientCacheVersion", 0)) if (int clientCacheId = sConfig.GetIntDefault("ClientCacheVersion", 0))
{ {
// overwrite DB/old value // overwrite DB/old value
@ -2554,4 +2556,4 @@ void World::UpdatePhaseDefinitions()
if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld()) if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
itr->second->GetPlayer()->GetPhaseMgr()->NotifyStoresReloaded(); itr->second->GetPlayer()->GetPhaseMgr()->NotifyStoresReloaded();
} }
} }

View file

@ -356,6 +356,7 @@ enum eConfigBoolValues
CONFIG_BOOL_VMAP_INDOOR_CHECK, CONFIG_BOOL_VMAP_INDOOR_CHECK,
CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT, CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT,
CONFIG_BOOL_MMAP_ENABLED, CONFIG_BOOL_MMAP_ENABLED,
CONFIG_BOOL_PLAYER_COMMANDS,
CONFIG_BOOL_GUILD_LEVELING_ENABLED, CONFIG_BOOL_GUILD_LEVELING_ENABLED,
CONFIG_BOOL_VALUE_COUNT CONFIG_BOOL_VALUE_COUNT
}; };

View file

@ -3,7 +3,7 @@
##################################### #####################################
[MangosdConf] [MangosdConf]
ConfVersion=2013012201 ConfVersion=2013122901
################################################################################################################### ###################################################################################################################
# CONNECTIONS AND DIRECTORIES # CONNECTIONS AND DIRECTORIES
@ -757,6 +757,11 @@ LogColors = ""
# Default: 0 (not wait) # Default: 0 (not wait)
# N (>0, wait N secs) # N (>0, wait N secs)
# #
# PlayerCommands
# Should player chat be parsed for GM commands.
# Default: 0 (ignore commands)
# 1 (parse commands)
#
# Motd # Motd
# Message of the Day. Displayed at worldlogin for every user ('@' for a newline). # Message of the Day. Displayed at worldlogin for every user ('@' for a newline).
# #
@ -833,6 +838,7 @@ Event.Announce = 0
BeepAtStart = 1 BeepAtStart = 1
ShowProgressBars = 1 ShowProgressBars = 1
WaitAtStartupError = 0 WaitAtStartupError = 0
PlayerCommands = 0
Motd = "Welcome to the Massive Network Game Object Server." Motd = "Welcome to the Massive Network Game Object Server."
Raid.MinLevel = 10 Raid.MinLevel = 10

View file

@ -36,7 +36,7 @@
// Format is YYYYMMDDRR where RR is the change in the conf file // Format is YYYYMMDDRR where RR is the change in the conf file
// for that day. // for that day.
#ifndef _MANGOSDCONFVERSION #ifndef _MANGOSDCONFVERSION
# define _MANGOSDCONFVERSION 2013012201 # define _MANGOSDCONFVERSION 2013122901
#endif #endif
#ifndef _REALMDCONFVERSION #ifndef _REALMDCONFVERSION
# define _REALMDCONFVERSION 2010062001 # define _REALMDCONFVERSION 2010062001

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12756" #define REVISION_NR "12757"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__