summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-17 20:17:33 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-17 20:20:33 +0100
commite02c372c50b3d8b498661a05183f460ae6ae395f (patch)
tree870758913ad8880b8c86e0168e4334c7722df9ee /src/gui/chat.cpp
parent26a52e8f74306b6e13e7a2029c19d8c7e1efd23a (diff)
parenta40c16cac5356d18aa6fc3f4549ece152713cfe2 (diff)
downloadmana-e02c372c50b3d8b498661a05183f460ae6ae395f.tar.gz
mana-e02c372c50b3d8b498661a05183f460ae6ae395f.tar.bz2
mana-e02c372c50b3d8b498661a05183f460ae6ae395f.tar.xz
mana-e02c372c50b3d8b498661a05183f460ae6ae395f.zip
Merge branch 'aethyra/master'
Conflicts: src/gui/npc_text.cpp src/gui/npc_text.h src/gui/npcintegerdialog.cpp src/gui/npclistdialog.cpp src/gui/npcstringdialog.cpp src/net/npchandler.cpp src/npc.cpp
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp22
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);