From b7798fb6e16957b916349bd30ff14a12570f5a59 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 27 Jul 2015 23:03:21 +0300 Subject: Detect broken nicks and report in debug tab. --- src/gui/windows/chatwindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/gui/windows/chatwindow.cpp') 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) { -- cgit v1.2.3-60-g2f50