summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/windows/chatwindow.cpp20
-rw-r--r--src/net/eathena/chathandler.cpp3
2 files changed, 19 insertions, 4 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())
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 79571f012..4e2c9969c 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -379,7 +379,7 @@ void ChatHandler::processColorChat(Net::MessageIn &msg)
}
processChatContinue(msg.readRawString(chatMsgLength, "message"),
- ChatMsgType::BY_SERVER);
+ ChatMsgType::BY_UNKNOWN);
}
std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg,
@@ -394,7 +394,6 @@ std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg,
{
channel = std::string("#").append(msg.substr(0, idx));
chatMsg = msg.substr(idx + 3);
- own = ChatMsgType::BY_OTHER;
}
}
return channel;