diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/clientopcodes.cpp | 2 | ||||
-rw-r--r-- | src/network/clientpackethandler.cpp | 5 | ||||
-rw-r--r-- | src/network/networkprotocol.h | 19 | ||||
-rw-r--r-- | src/network/serveropcodes.cpp | 2 | ||||
-rw-r--r-- | src/network/serverpackethandler.cpp | 2 |
5 files changed, 25 insertions, 5 deletions
diff --git a/src/network/clientopcodes.cpp b/src/network/clientopcodes.cpp index f39dd6db6..8ac9cee1f 100644 --- a/src/network/clientopcodes.cpp +++ b/src/network/clientopcodes.cpp @@ -66,7 +66,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] = { "TOCLIENT_INVENTORY", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Inventory }, // 0x27 null_command_handler, { "TOCLIENT_TIME_OF_DAY", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_TimeOfDay }, // 0x29 - null_command_handler, + { "TOCLIENT_CSM_FLAVOUR_LIMITS", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_CSMFlavourLimits }, // 0x2A null_command_handler, null_command_handler, null_command_handler, diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index bb4db6f47..d06f8a94d 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1376,3 +1376,8 @@ void Client::handleCommand_SrpBytesSandB(NetworkPacket* pkt) resp_pkt << std::string(bytes_M, len_M); Send(&resp_pkt); } + +void Client::handleCommand_CSMFlavourLimits(NetworkPacket *pkt) +{ + *pkt >> m_csm_flavour_limits >> m_csm_noderange_limit; +} diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index 759334839..b210d3d2e 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -17,8 +17,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef NETWORKPROTOCOL_HEADER -#define NETWORKPROTOCOL_HEADER +#pragma once + #include "util/string.h" /* @@ -168,6 +168,7 @@ with this program; if not, write to the Free Software Foundation, Inc., * sender * type (RAW, NORMAL, ANNOUNCE, SYSTEM) * content + Add TOCLIENT_CSM_FLAVOUR_LIMITS to define which CSM flavour should be limited */ #define LATEST_PROTOCOL_VERSION 35 @@ -313,6 +314,11 @@ enum ToClientCommand f1000 time_speed */ + TOCLIENT_CSM_FLAVOUR_LIMITS = 0x2A, + /* + u32 CSMFlavourLimits byteflag + */ + // (oops, there is some gap here) TOCLIENT_CHAT_MESSAGE = 0x2F, @@ -1003,5 +1009,12 @@ enum PlayerListModifer: u8 PLAYER_LIST_REMOVE, }; +enum CSMFlavourLimit : u64 { + CSM_FL_NONE = 0x00000000, + CSM_FL_LOOKUP_NODES = 0x00000001, // Limit node lookups + CSM_FL_CHAT_MESSAGES = 0x00000002, // Disable chat message sending from CSM + CSM_FL_READ_ITEMDEFS = 0x00000004, // Disable itemdef lookups + CSM_FL_READ_NODEDEFS = 0x00000008, // Disable nodedef lookups + CSM_FL_ALL = 0xFFFFFFFF, +}; -#endif diff --git a/src/network/serveropcodes.cpp b/src/network/serveropcodes.cpp index 208214369..30357b881 100644 --- a/src/network/serveropcodes.cpp +++ b/src/network/serveropcodes.cpp @@ -155,7 +155,7 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] = { "TOCLIENT_INVENTORY", 0, true }, // 0x27 null_command_factory, { "TOCLIENT_TIME_OF_DAY", 0, true }, // 0x29 - null_command_factory, + { "TOCLIENT_CSM_FLAVOUR_LIMITS", 0, true }, // 0x2A null_command_factory, null_command_factory, null_command_factory, diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index b87daba6b..2151450d2 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -643,6 +643,8 @@ void Server::handleCommand_Init2(NetworkPacket* pkt) float time_speed = g_settings->getFloat("time_speed"); SendTimeOfDay(pkt->getPeerId(), time, time_speed); + SendCSMFlavourLimits(pkt->getPeerId()); + // Warnings about protocol version can be issued here if (getClient(pkt->getPeerId())->net_proto_version < LATEST_PROTOCOL_VERSION) { SendChatMessage(pkt->getPeerId(), ChatMessage(CHATMESSAGE_TYPE_SYSTEM, |