summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-09 20:29:51 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-09 20:31:28 +0100
commita69fe2636b8c658ba9efa604059232b203243e46 (patch)
treef7c199d1689a635fa9cb0aeec431e825b7cd1bfe /src/gui/chat.cpp
parentbab09df7a8347f39221b2a87487dcd128a686def (diff)
downloadmana-a69fe2636b8c658ba9efa604059232b203243e46.tar.gz
mana-a69fe2636b8c658ba9efa604059232b203243e46.tar.bz2
mana-a69fe2636b8c658ba9efa604059232b203243e46.tar.xz
mana-a69fe2636b8c658ba9efa604059232b203243e46.zip
Fixed two issues with the chat message parsing
Don't treat anything starting with "Welcome" as a server message, for example messages starting with a name that starts with "Welcome" shouldn't belong in that category. Put the nick in the right place for global announcements. Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 0c7cc1db..edde42d0 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -102,22 +102,26 @@ ChatWindow::chatLog(std::string line, int own)
tmp.nick = "";
tmp.text = line;
- // Fix the owner of welcome message.
- if (line.substr(0, 7) == "Welcome")
- {
- own = BY_SERVER;
- }
-
std::string::size_type pos = line.find(" : ");
if (pos != std::string::npos) {
tmp.nick = line.substr(0, pos);
tmp.text = line.substr(pos + 3);
+ } else {
+ // Fix the owner of welcome message.
+ if (line.substr(0, 7) == "Welcome")
+ {
+ own = BY_SERVER;
+ }
}
std::string lineColor = "##0"; // Equiv. to BrowserBox::BLACK
switch (own) {
case BY_GM:
- tmp.nick += std::string("Global announcement: ");
+ if (tmp.nick.empty())
+ tmp.nick = std::string("Global announcement: ");
+ else
+ tmp.nick = std::string("Global announcement from " + tmp.nick
+ + std::string(": "));
lineColor = "##1"; // Equiv. to BrowserBox::RED
break;
case BY_PLAYER: