diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-19 20:30:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-19 20:30:45 +0300 |
commit | 1f2dd660dad937a3c1f2a2dfc07b756965e4ddae (patch) | |
tree | beb8ffac5065b92cf4d2511482056a02ea46f6a2 /src/gui/windows/chatwindow.cpp | |
parent | 81c73d43071de8ac22af1b7b9174cab1809203ba (diff) | |
download | manaplus-1f2dd660dad937a3c1f2a2dfc07b756965e4ddae.tar.gz manaplus-1f2dd660dad937a3c1f2a2dfc07b756965e4ddae.tar.bz2 manaplus-1f2dd660dad937a3c1f2a2dfc07b756965e4ddae.tar.xz manaplus-1f2dd660dad937a3c1f2a2dfc07b756965e4ddae.zip |
fix pet talk and emote if trade tab is disabled.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 60 |
1 files changed, 33 insertions, 27 deletions
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) { |