summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-09 20:29:51 +0100
committerIra Rice <irarice@gmail.com>2008-12-09 18:01:53 -0700
commite2a74899c5ab96a4a1dc848ca8e48df9b126a70a (patch)
tree88758ca0fd3f9e051adfdd8acaf5725cbd0f5dba
parent197b8ef1b728aca409a3a5bd2ac6d52142c6ce4c (diff)
downloadmana-client-e2a74899c5ab96a4a1dc848ca8e48df9b126a70a.tar.gz
mana-client-e2a74899c5ab96a4a1dc848ca8e48df9b126a70a.tar.bz2
mana-client-e2a74899c5ab96a4a1dc848ca8e48df9b126a70a.tar.xz
mana-client-e2a74899c5ab96a4a1dc848ca8e48df9b126a70a.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>
-rw-r--r--src/gui/chat.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index eef1150f..34e7b04b 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -120,22 +120,33 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
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 = "##C";
switch (own) {
case BY_GM:
- tmp.nick += std::string("Global announcement: ");
- lineColor = "##G";
+ if (tmp.nick.empty())
+ {
+ tmp.nick = std::string("Global announcement: ");
+ lineColor = "##G";
+ }
+ else
+ {
+ tmp.nick = std::string("Global announcement from " + tmp.nick
+ + std::string(": "));
+ lineColor = "##1"; // Equiv. to BrowserBox::RED
+ }
break;
case BY_PLAYER:
tmp.nick += CAT_NORMAL;