From ea55a22a71a6fd46877bc4b6b56d6205dd20608f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 16 Feb 2014 23:51:32 +0100 Subject: Links sent via chat messages are clickable. Fixes #658. --- src/ClientHandle.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index b46bcfd47..c91a0c01b 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1089,14 +1089,20 @@ void cClientHandle::HandleChat(const AString & a_Message) return; } - // Not a command, broadcast as a simple message: - AString Msg; - Printf(Msg, "%s<%s>%s %s", - m_Player->GetColor().c_str(), - m_Player->GetName().c_str(), - cChatColor::White.c_str(), - Message.c_str() - ); + // Not a command, broadcast as a message: + cCompositeChat Msg; + AString Color = m_Player->GetColor(); + if (Color.length() == 3) + { + Color = AString("@") + Color[2]; + } + else + { + Color.empty(); + } + Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color); + Msg.ParseText(a_Message); + Msg.UnderlineUrls(); m_Player->GetWorld()->BroadcastChat(Msg); } -- cgit v1.2.3