MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / disconnectClient

Method disconnectClient

source/game/StarChatProcessor.cpp:29–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29List<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
51List<ConnectionId> ChatProcessor::clients() const {
52 RecursiveMutexLocker locker(m_mutex);

Callers 1

kickMethod · 0.45

Calls 4

strfFunction · 0.85
takeMethod · 0.45
removeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected