Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide login cmd from chat history #3725

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
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
Loading