diff options
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r-- | src/gui/chat.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index ba4885fe..89588cee 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -116,12 +116,14 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) // Trim whitespace trim(line); + if (line.empty()) + return; + CHATLOG tmp; tmp.own = own; tmp.nick = ""; tmp.text = line; - std::string::size_type pos = line.find(" : "); if (pos != std::string::npos) { @@ -331,6 +333,24 @@ void ChatWindow::whisper(const std::string &nick, std::string msg) } } + trim(msg); + + std::string playerName = player_node->getName(); + std::string tempNick = recvnick; + + for (unsigned int i = 0; i < playerName.size(); i++) + { + playerName[i] = (char) tolower(playerName[i]); + } + + for (unsigned int i = 0; i < tempNick.size(); i++) + { + tempNick[i] = (char) tolower(tempNick[i]); + } + + if (tempNick.compare(playerName) == 0 || msg.empty()) + return; + MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_CHAT_WHISPER); outMsg.writeInt16(msg.length() + 28); |