From 02d2f61628927de7b86bba2f9455dcf05c37f78d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Dec 2013 01:36:11 +0300 Subject: dont show over head text if text ignored or going to trade tab. --- src/gui/windows/chatwindow.cpp | 11 ++++++----- src/gui/windows/chatwindow.h | 2 +- src/net/ea/chathandler.cpp | 10 ++++++---- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index ea7a372d4..d658ae183 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1452,7 +1452,7 @@ std::string ChatWindow::autoCompleteHistory(const std::string &partName) const return autoComplete(nameList, partName); } -void ChatWindow::resortChatLog(std::string line, Own own, +bool ChatWindow::resortChatLog(std::string line, Own own, const std::string &channel, const bool ignoreRecord, const bool tryRemoveColors) @@ -1470,7 +1470,7 @@ void ChatWindow::resortChatLog(std::string line, Own own, { tradeChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); - return; + return false; } size_t idx2 = line.find(": "); @@ -1481,11 +1481,11 @@ void ChatWindow::resortChatLog(std::string line, Own own, { // ignore special message formats. if (line.find(": \302\202\302") != std::string::npos) - return; + return false; line = line.erase(idx + 2, 2); tradeChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); - return; + return false; } } @@ -1502,7 +1502,7 @@ void ChatWindow::resortChatLog(std::string line, Own own, { tradeChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); - return; + return false; } } } @@ -1533,6 +1533,7 @@ void ChatWindow::resortChatLog(std::string line, Own own, { localChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); } + return true; } void ChatWindow::battleChatLog(const std::string &line, Own own, diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index d93e2ce94..a1a7d77ee 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -233,7 +233,7 @@ class ChatWindow final : public Window, void ignoreAllWhispers(); - void resortChatLog(std::string line, Own own, + bool resortChatLog(std::string line, Own own, const std::string &channel, const bool ignoreRecord, const bool tryRemoveColors); diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index a10bf931d..267d1102d 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -310,17 +310,18 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg, trim(chatMsg); + bool allow(true); // We use getIgnorePlayer instead of ignoringPlayer here // because ignorePlayer' side effects are triggered // right below for Being::IGNORE_SPEECH_FLOAT. if (player_relations.checkPermissionSilently(sender_name, PlayerRelation::SPEECH_LOG) && chatWindow) { - chatWindow->resortChatLog(removeColors(sender_name) + allow = chatWindow->resortChatLog(removeColors(sender_name) .append(" : ").append(chatMsg), BY_OTHER, channel, false, true); } - if (player_relations.hasPermission(sender_name, + if (allow && player_relations.hasPermission(sender_name, PlayerRelation::SPEECH_FLOAT)) { being->setSpeech(chatMsg, channel); @@ -352,9 +353,10 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat, if (normalChat) { + bool allow(true); if (chatWindow) { - chatWindow->resortChatLog(chatMsg, BY_PLAYER, + allow = chatWindow->resortChatLog(chatMsg, BY_PLAYER, channel, false, true); } @@ -386,7 +388,7 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat, if (player_node) { - if (chatWindow || mShowMotd) + if ((chatWindow || mShowMotd) && allow) player_node->setSpeech(chatMsg, channel); } } -- cgit v1.2.3-70-g09d2