From a69fe2636b8c658ba9efa604059232b203243e46 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 9 Dec 2008 20:29:51 +0100 Subject: Fixed two issues with the chat message parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/chat.cpp | 18 +++++++++++------- 1 file 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: -- cgit v1.2.3-70-g09d2