Skip to content

Commit

Permalink
Censor 'login' command in chat history (solves multitheftauto#2518)
Browse files Browse the repository at this point in the history
Censors /login command in chatbox history. This will also stop loging anything said using `/bind <key> chatbox login`
  • Loading branch information
PlatinMTA committed Sep 15, 2024
1 parent 961dcac commit ced6734
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Client/core/CChat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,28 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)

// If the input isn't empty and isn't identical to the previous entry in history, add it to the history
if (!m_strInputText.empty() && (m_pInputHistory->Empty() || m_pInputHistory->GetLast() != m_strInputText))
m_pInputHistory->Add(m_strInputText);
{
if (m_strCommand.empty() && m_strInputText[0] != '/')
{
// If the input is not a command, store it
m_pInputHistory->Add(m_strInputText);
}
else if (m_strCommand.compare("login") != 0)
{
// If the input is a command, check that it isn't the 'login' command, if it is censor it
char szInput[256];
strncpy(szInput, m_strInputText.c_str() + 1, 256);

const char* szCommand;
if (szInput[0])
szCommand = strtok(szInput, " ");

if ((strcmp(szCommand, "login") != 0))
m_pInputHistory->Add(m_strInputText);
else if ((m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/login")))
m_pInputHistory->Add("/login");
}
}

SetInputVisible(false);

Expand Down

0 comments on commit ced6734

Please sign in to comment.