summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-27 23:03:21 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-27 23:03:21 +0300
commitb7798fb6e16957b916349bd30ff14a12570f5a59 (patch)
treeb8f5e639c9e82d1ae570dc6199db85807a5fb3b4
parent9b68f83d94a706de6ba932fe7bfb7f5158cfecb1 (diff)
downloadplus-b7798fb6e16957b916349bd30ff14a12570f5a59.tar.gz
plus-b7798fb6e16957b916349bd30ff14a12570f5a59.tar.bz2
plus-b7798fb6e16957b916349bd30ff14a12570f5a59.tar.xz
plus-b7798fb6e16957b916349bd30ff14a12570f5a59.zip
Detect broken nicks and report in debug tab.
-rw-r--r--src/gui/windows/chatwindow.cpp16
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)
{