Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions Client/core/CChat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,34 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
// If the input is not a command, store it
m_pInputHistory->Add(m_strInputText);
}
else if (m_strCommand.compare("login") != 0)
else
{
// If the input is a command, check that it isn't the 'login' command, if it is censor it
// If the input is a command, check that it isn't the 'login' or 'register' command, if it is censor it
char szInput[256];
unsigned int uiLength = sizeof(szInput) - 1;

strncpy(szInput, m_strInputText.c_str() + 1, uiLength);
szInput[uiLength] = '\0';

const char* szCommand = strtok(szInput, " ");

if (szCommand && (strcmp(szCommand, "login") != 0))

if (szCommand && (strcmp(szCommand, "login") == 0))
{
// Censor the login command
if (m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/login"))
m_pInputHistory->Add("/login");
}
else if (szCommand && (strcmp(szCommand, "register") == 0))
{
// Censor the register command
if (m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/register"))
m_pInputHistory->Add("/register");
}
else
{
// Store the command as-is
m_pInputHistory->Add(m_strInputText);
else if ((m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/login")))
m_pInputHistory->Add("/login");
}
}
}

Expand Down