diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-13 18:46:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-13 18:46:33 +0300 |
commit | cb953c324d886f480dacb41f632e4dc977945021 (patch) | |
tree | d594fd5f505e5807e2047c85ee8c81220eccaab5 /src/gui/windows/chatwindow.cpp | |
parent | ae33dbfa0cdf7464786e65b8015481e85c31244d (diff) | |
download | manaplus-cb953c324d886f480dacb41f632e4dc977945021.tar.gz manaplus-cb953c324d886f480dacb41f632e4dc977945021.tar.bz2 manaplus-cb953c324d886f480dacb41f632e4dc977945021.tar.xz manaplus-cb953c324d886f480dacb41f632e4dc977945021.zip |
eathena: fix owner for channel messages.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 77f57a9ea..73ab5a0cf 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1460,13 +1460,29 @@ std::string ChatWindow::autoCompleteHistory(const std::string &partName) const return autoComplete(nameList, partName); } -bool ChatWindow::resortChatLog(std::string line, ChatMsgType::Type own, +bool ChatWindow::resortChatLog(std::string line, + ChatMsgType::Type own, const std::string &channel, const bool ignoreRecord, const bool tryRemoveColors) { if (own == ChatMsgType::BY_UNKNOWN) - own = ChatMsgType::BY_SERVER; + { + const size_t pos = line.find(" : "); + if (pos != std::string::npos) + { + if (line.length() <= pos + 3) + own = ChatMsgType::BY_SERVER; + else if (line.substr(0, pos) == localPlayer->getName()) + own = ChatMsgType::BY_PLAYER; + else + own = ChatMsgType::BY_OTHER; + } + else + { + own = ChatMsgType::BY_SERVER; + } + } std::string prefix; if (!channel.empty()) |