| 1095 | } |
| 1096 | |
| 1097 | void UniverseServer::processChat() { |
| 1098 | RecursiveMutexLocker locker(m_mainLock); |
| 1099 | ReadLocker clientsLocker(m_clientsLock); |
| 1100 | |
| 1101 | for (auto const& p : take(m_pendingChat)) { |
| 1102 | if (auto clientContext = m_clients.get(p.first)) { |
| 1103 | for (auto const& chat : p.second) { |
| 1104 | auto& message = get<0>(chat); |
| 1105 | auto sendMode = get<1>(chat); |
| 1106 | auto& data = get<2>(chat); |
| 1107 | if (clientContext->remoteAddress()) |
| 1108 | Logger::info("Chat: <{}> {}", clientContext->playerName(), message); |
| 1109 | |
| 1110 | auto team = m_teamManager->getTeam(clientContext->playerUuid()); |
| 1111 | locker.unlock(); |
| 1112 | if (sendMode == ChatSendMode::Broadcast) |
| 1113 | m_chatProcessor->broadcast(p.first, message, std::move(data)); |
| 1114 | else if (sendMode == ChatSendMode::Party && team.isValid()) |
| 1115 | m_chatProcessor->message(p.first, MessageContext::Mode::Party, team.value().hex(), message, std::move(data)); |
| 1116 | else |
| 1117 | m_chatProcessor->message(p.first, MessageContext::Mode::Local, printWorldId(clientContext->playerWorldId()), message, std::move(data)); |
| 1118 | locker.lock(); |
| 1119 | } |
| 1120 | } |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | void UniverseServer::clearBrokenWorlds() { |
| 1125 | RecursiveMutexLocker locker(m_mainLock); |
nothing calls this directly
no test coverage detected