| 1157 | |
| 1158 | |
| 1159 | void cClientHandle::HandleChat(const AString & a_Message) |
| 1160 | { |
| 1161 | // We no longer need to postpone message processing, because the messages already arrive in the Tick thread |
| 1162 | |
| 1163 | // If a command, perform it: |
| 1164 | AString Message(a_Message); |
| 1165 | if (cRoot::Get()->GetServer()->Command(*this, Message)) |
| 1166 | { |
| 1167 | return; |
| 1168 | } |
| 1169 | |
| 1170 | // Not a command, broadcast as a message: |
| 1171 | cCompositeChat Msg; |
| 1172 | AString Color = m_Player->GetColor(); |
| 1173 | if (Color.length() == 3) |
| 1174 | { |
| 1175 | Color = AString("@") + Color[2]; |
| 1176 | } |
| 1177 | else |
| 1178 | { |
| 1179 | Color.empty(); |
| 1180 | } |
| 1181 | Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color); |
| 1182 | Msg.ParseText(a_Message); |
| 1183 | Msg.UnderlineUrls(); |
| 1184 | m_Player->GetWorld()->BroadcastChat(Msg); |
| 1185 | } |
| 1186 | |
| 1187 | |
| 1188 |
no test coverage detected