From 165556c8ddf4d3a036d6d89e680e208d2b435866 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Feb 2014 23:57:17 +0300 Subject: improve autocomplete sanitization. --- src/gui/windows/chatwindow.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/gui/windows/chatwindow.cpp') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 976a8dfd8..5b0bb69b6 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1312,7 +1312,6 @@ void ChatWindow::autoComplete() const int caretPos = mChatInput->getCaretPosition(); int startName = 0; const std::string inputText = mChatInput->getText(); - bool needSecure(false); std::string name = inputText.substr(0, caretPos); for (int f = caretPos - 1; f > -1; f --) @@ -1335,15 +1334,15 @@ void ChatWindow::autoComplete() if (cTab) cTab->getAutoCompleteList(nameList); std::string newName = autoComplete(nameList, name); - if (!newName.empty()) - needSecure = true; + if (!newName.empty() && !startName) + secureChatCommand(newName); if (newName.empty() && actorManager) { actorManager->getPlayerNames(nameList, true); newName = autoComplete(nameList, name); - if (!newName.empty()) - needSecure = true; + if (!newName.empty() && !startName) + secureChatCommand(newName); } if (newName.empty()) newName = autoCompleteHistory(name); @@ -1366,11 +1365,6 @@ void ChatWindow::autoComplete() if (!newName.empty()) { - if (!startName && needSecure && (newName[0] == '/' - || newName[0] == '@' || newName[0] == '#')) - { - newName = "_" + newName; - } mChatInput->setText(inputText.substr(0, startName).append(newName) .append(inputText.substr(caretPos, inputText.length() - caretPos))); -- cgit v1.2.3-60-g2f50