summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 22126af3..a2ad102d 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -310,6 +310,11 @@ bool ChatWindow::isInputFocused()
void ChatWindow::whisper(const std::string &nick, std::string msg)
{
+ trim(msg);
+
+ if (msg.empty())
+ return;
+
std::string recvnick = "";
if (msg.substr(0, 1) == "\"")
@@ -331,6 +336,22 @@ void ChatWindow::whisper(const std::string &nick, std::string 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)
+ return;
+
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_CHAT_WHISPER);
outMsg.writeInt16(msg.length() + 28);