summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-09-19 17:28:33 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-09-19 17:28:33 +0000
commit1a9320fafb23940d0463e6f384713d0f99fc0c61 (patch)
treed152680dbdc8febf0b5a445ba760255068d72f04 /src/gui/chat.cpp
parent2f027ebcf8f0ad78f7edf58af7dda94d89034c85 (diff)
downloadmana-1a9320fafb23940d0463e6f384713d0f99fc0c61.tar.gz
mana-1a9320fafb23940d0463e6f384713d0f99fc0c61.tar.bz2
mana-1a9320fafb23940d0463e6f384713d0f99fc0c61.tar.xz
mana-1a9320fafb23940d0463e6f384713d0f99fc0c61.zip
Merged 0.0 changes from revision 3362 to 3580 to trunk.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index ba7c7f02..4ed8bb97 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -44,6 +44,7 @@
#include "../net/gameserver/player.h"
#include "../utils/dtor.h"
+#include "../utils/trim.h"
ChatWindow::ChatWindow():
Window(),
@@ -125,7 +126,7 @@ void
ChatWindow::chatLog(std::string line, int own, std::string channelName)
{
// Delete overhead from the end of the list
- while ((int)mChatlog.size() > mItemsKeep) {
+ while ((int) mChatlog.size() > mItemsKeep) {
mChatlog.pop_back();
}
@@ -142,12 +143,15 @@ ChatWindow::chatLog(std::string line, int own, std::string channelName)
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: