From 25fe5471c500604609eff7659711e8593169df35 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 27 Sep 2020 00:30:47 +0200 Subject: [PATCH] Handle rcon cmds properly with dummy Only active player received them, reconnecting dummy a few times lead to duplicate entries in tab completion. Now only main player is considered for the completion. as reported by Betz@lel-$h@l0m on Discord --- src/engine/client/client.cpp | 42 +++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 0da65a1aa..c90eaf985 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1805,17 +1805,23 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) } else if((pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_ADD) { - const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC); - const char *pHelp = Unpacker.GetString(CUnpacker::SANITIZE_CC); - const char *pParams = Unpacker.GetString(CUnpacker::SANITIZE_CC); - if(Unpacker.Error() == 0) - m_pConsole->RegisterTemp(pName, pParams, CFGFLAG_SERVER, pHelp); + if(!g_Config.m_ClDummy) + { + const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC); + const char *pHelp = Unpacker.GetString(CUnpacker::SANITIZE_CC); + const char *pParams = Unpacker.GetString(CUnpacker::SANITIZE_CC); + if(Unpacker.Error() == 0) + m_pConsole->RegisterTemp(pName, pParams, CFGFLAG_SERVER, pHelp); + } } else if((pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_REM) { - const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC); - if(Unpacker.Error() == 0) - m_pConsole->DeregisterTemp(pName); + if(!g_Config.m_ClDummy) + { + const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC); + if(Unpacker.Error() == 0) + m_pConsole->DeregisterTemp(pName); + } } else if((pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_AUTH_STATUS) { @@ -2130,6 +2136,26 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket) if(m_RconAuthed[0]) RconAuth("", m_RconPassword); } + else if(Msg == NETMSG_RCON_CMD_ADD) + { + if(g_Config.m_ClDummy) + { + const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC); + const char *pHelp = Unpacker.GetString(CUnpacker::SANITIZE_CC); + const char *pParams = Unpacker.GetString(CUnpacker::SANITIZE_CC); + if(Unpacker.Error() == 0) + m_pConsole->RegisterTemp(pName, pParams, CFGFLAG_SERVER, pHelp); + } + } + else if(Msg == NETMSG_RCON_CMD_REM) + { + if(g_Config.m_ClDummy) + { + const char *pName = Unpacker.GetString(CUnpacker::SANITIZE_CC); + if(Unpacker.Error() == 0) + m_pConsole->DeregisterTemp(pName); + } + } else if(Msg == NETMSG_SNAP || Msg == NETMSG_SNAPSINGLE || Msg == NETMSG_SNAPEMPTY) { int NumParts = 1;