From d155816b5c271a0ed549e19128a54ef2f4a7a72a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Feb 2016 15:37:13 +0300 Subject: Improve trade spam filterring. If trade filter move text to trade tab, in previous tab for author it will leave message about moving. In trade tab moved text will be with prefix "Moved: " --- src/gui/windows/chatwindow.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 0934be0ff..940eb75e5 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1537,18 +1537,25 @@ bool ChatWindow::resortChatLog(std::string line, std::string prefix; if (!channel.empty()) + { prefix = std::string("##3").append(channel).append("##0"); - - if (findI(line, mTradeFilter) != std::string::npos) + } + else if (tradeChatTab && + findI(line, mTradeFilter) != std::string::npos) { - if (tradeChatTab) + tradeChatTab->chatLog(std::string("##S") + _("Moved: ") + line, + own, + ignoreRecord, + tryRemoveColors); + if (own == ChatMsgType::BY_PLAYER) { - tradeChatTab->chatLog(prefix + line, - own, - ignoreRecord, - tryRemoveColors); + own = ChatMsgType::BY_SERVER; + line = _("Your message was moved to trade tab"); + } + else + { + return false; } - return false; } size_t idx2 = line.find(": "); -- cgit v1.2.3-60-g2f50