summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-08-22 16:32:52 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-08-22 16:32:52 +0000
commit4346b429cc875a85095fff271a8d82a46c2cfc91 (patch)
tree45c427f607ef331f3be5dd0b29d960cf01076cc6 /src/gui/chat.cpp
parent10ebf4484985b98e9248c8de84b35af9b6e26d3a (diff)
downloadmana-4346b429cc875a85095fff271a8d82a46c2cfc91.tar.gz
mana-4346b429cc875a85095fff271a8d82a46c2cfc91.tar.bz2
mana-4346b429cc875a85095fff271a8d82a46c2cfc91.tar.xz
mana-4346b429cc875a85095fff271a8d82a46c2cfc91.zip
Added trimming of chat messages.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index aea92d4f..d760f18d 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -39,6 +39,8 @@
#include "../net/messageout.h"
#include "../net/protocol.h"
+#include "../utils/trim.h"
+
ChatWindow::ChatWindow(Network *network):
Window(""),
mNetwork(network),
@@ -109,12 +111,15 @@ ChatWindow::chatLog(std::string line, int own)
own = BY_SERVER;
}
- int pos = line.find(" : ");
- if (pos > 0) {
+ std::string::size_type pos = line.find(" : ");
+ if (pos != std::string::npos) {
tmp.nick = line.substr(0, pos);
line.erase(0, pos + 3);
}
+ // Trim whitespace
+ trim(line);
+
std::string lineColor = "##0"; // Equiv. to BrowserBox::BLACK
switch (own) {
case BY_GM: