From 4346b429cc875a85095fff271a8d82a46c2cfc91 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 22 Aug 2007 16:32:52 +0000 Subject: Added trimming of chat messages. --- src/gui/chat.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gui/chat.cpp') 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: -- cgit v1.2.3-70-g09d2