| 27 | } |
| 28 | |
| 29 | List<ChatReceivedMessage> ChatProcessor::disconnectClient(ConnectionId clientId) { |
| 30 | RecursiveMutexLocker locker(m_mutex); |
| 31 | |
| 32 | for (auto channel : clientChannels(clientId)) |
| 33 | leaveChannel(clientId, channel); |
| 34 | |
| 35 | auto clientInfo = m_clients.take(clientId); |
| 36 | |
| 37 | m_nicks.remove(clientInfo.nick); |
| 38 | |
| 39 | for (auto& pair : m_clients) { |
| 40 | pair.second.pendingMessages.append({ |
| 41 | {MessageContext::Broadcast}, |
| 42 | ServerConnectionId, |
| 43 | ServerNick, |
| 44 | strf("Player '{}' disconnected", clientInfo.nick) |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | return clientInfo.pendingMessages; |
| 49 | } |
| 50 | |
| 51 | List<ConnectionId> ChatProcessor::clients() const { |
| 52 | RecursiveMutexLocker locker(m_mutex); |