summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-16 23:51:32 +0100
committermadmaxoft <github@xoft.cz>2014-02-16 23:51:32 +0100
commitea55a22a71a6fd46877bc4b6b56d6205dd20608f (patch)
tree3effb7f1081a9930129d5f875af49d429c3a9211 /src/ClientHandle.cpp
parentImplemented cCompositeChat::ParseText(), incl. self-test. (diff)
downloadcuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.tar
cuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.tar.gz
cuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.tar.bz2
cuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.tar.lz
cuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.tar.xz
cuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.tar.zst
cuberite-ea55a22a71a6fd46877bc4b6b56d6205dd20608f.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp22
1 files changed, 14 insertions, 8 deletions
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);
}