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.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: