diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-27 23:03:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-27 23:03:21 +0300 |
commit | b7798fb6e16957b916349bd30ff14a12570f5a59 (patch) | |
tree | b8f5e639c9e82d1ae570dc6199db85807a5fb3b4 /src/gui/windows | |
parent | 9b68f83d94a706de6ba932fe7bfb7f5158cfecb1 (diff) | |
download | manaverse-b7798fb6e16957b916349bd30ff14a12570f5a59.tar.gz manaverse-b7798fb6e16957b916349bd30ff14a12570f5a59.tar.bz2 manaverse-b7798fb6e16957b916349bd30ff14a12570f5a59.tar.xz manaverse-b7798fb6e16957b916349bd30ff14a12570f5a59.zip |
Detect broken nicks and report in debug tab.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index f7a101a44..b292d20f1 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1553,6 +1553,22 @@ bool ChatWindow::resortChatLog(std::string line, size_t idx2 = line.find(": "); if (idx2 != std::string::npos) { + std::string nick = line.substr(0, idx2); + if (nick.find("#") != std::string::npos || + nick.find(":") != std::string::npos || + nick.find("%") != std::string::npos || + nick.find("@") != std::string::npos) + { + replaceAll(nick, "#", "_"); + replaceAll(nick, "%", "_"); + const std::string errMsg = strprintf( + // TRANSLATORS: error message + _("Broken nick detected: %s"), nick.c_str()); + if (debugChatTab) + debugChatTab->chatLog(errMsg, ChatMsgType::BY_SERVER); + else + localChatTab->chatLog(errMsg, ChatMsgType::BY_SERVER); + } const size_t idx = line.find(": \302\202"); if (idx == idx2) { |