From 1f2dd660dad937a3c1f2a2dfc07b756965e4ddae Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 19 Jan 2014 20:30:45 +0300 Subject: fix pet talk and emote if trade tab is disabled. --- src/gui/windows/chatwindow.cpp | 60 +++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index e1afb6e5b..b9a2592fa 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1481,53 +1481,59 @@ bool ChatWindow::resortChatLog(std::string line, Own own, if (!channel.empty()) prefix = std::string("##3").append(channel).append("##0"); - if (tradeChatTab) + if (findI(line, mTradeFilter) != std::string::npos) { - if (findI(line, mTradeFilter) != std::string::npos) + if (tradeChatTab) { tradeChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); - return false; } + return false; + } - size_t idx2 = line.find(": "); - if (idx2 != std::string::npos) + size_t idx2 = line.find(": "); + if (idx2 != std::string::npos) + { + const size_t idx = line.find(": \302\202"); + if (idx == idx2) { - const size_t idx = line.find(": \302\202"); - if (idx == idx2) + if (line.find(": \302\202\302") != std::string::npos) { - if (line.find(": \302\202\302") != std::string::npos) + if (line.find(": \302\202\302e") != std::string::npos) { - if (line.find(": \302\202\302e") != std::string::npos) - { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - localPetEmote(nick, atoi(line.c_str())); - } - // ignore other special message formats. - return false; + const std::string nick = line.substr(0, idx2 - 1); + line = line.substr(idx2 + 6); + localPetEmote(nick, atoi(line.c_str())); } + // ignore other special message formats. + return false; + } - // pet talk message detected - if (line.find(": \302\202\303 ") != std::string::npos) + // pet talk message detected + if (line.find(": \302\202\303 ") != std::string::npos) + { + if (actorManager && idx2 > 1) { - if (actorManager && idx2 > 1) - { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - localPetSay(nick, line); - } - - return false; + const std::string nick = line.substr(0, idx2 - 1); + line = line.substr(idx2 + 6); + localPetSay(nick, line); } + return false; + } + + if (tradeChatTab) + { line = line.erase(idx + 2, 2); tradeChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); - return false; } + return false; } + } + if (tradeChatTab) + { const size_t idx1 = line.find("@@"); if (idx1 != std::string::npos) { -- cgit v1.2.3-70-g09d2