diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-11 23:57:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-11 23:57:17 +0300 |
commit | 165556c8ddf4d3a036d6d89e680e208d2b435866 (patch) | |
tree | 719d66843668bfb37cae499581960d2942c5b3fd /src/gui | |
parent | af8863d722f06153877d289b939b5ba84713621d (diff) | |
download | manaverse-165556c8ddf4d3a036d6d89e680e208d2b435866.tar.gz manaverse-165556c8ddf4d3a036d6d89e680e208d2b435866.tar.bz2 manaverse-165556c8ddf4d3a036d6d89e680e208d2b435866.tar.xz manaverse-165556c8ddf4d3a036d6d89e680e208d2b435866.zip |
improve autocomplete sanitization.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
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))); |