Skip to content

Commit bf3becd

Browse files
Synchronize changes from 1.6 master branch [ci skip]
4639aea Hide login cmd from chat history (#3725)
2 parents dad756b + 4639aea commit bf3becd

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Client/core/CChat.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,28 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
650650

651651
// If the input isn't empty and isn't identical to the previous entry in history, add it to the history
652652
if (!m_strInputText.empty() && (m_pInputHistory->Empty() || m_pInputHistory->GetLast() != m_strInputText))
653-
m_pInputHistory->Add(m_strInputText);
653+
{
654+
if (m_strCommand.empty() && m_strInputText[0] != '/')
655+
{
656+
// If the input is not a command, store it
657+
m_pInputHistory->Add(m_strInputText);
658+
}
659+
else if (m_strCommand.compare("login") != 0)
660+
{
661+
// If the input is a command, check that it isn't the 'login' command, if it is censor it
662+
char szInput[256];
663+
strncpy(szInput, m_strInputText.c_str() + 1, 256);
664+
665+
const char* szCommand;
666+
if (szInput[0])
667+
szCommand = strtok(szInput, " ");
668+
669+
if ((strcmp(szCommand, "login") != 0))
670+
m_pInputHistory->Add(m_strInputText);
671+
else if ((m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/login")))
672+
m_pInputHistory->Add("/login");
673+
}
674+
}
654675

655676
SetInputVisible(false);
656677

0 commit comments

Comments
 (0)