| 142 | } |
| 143 | |
| 144 | void ChatProcessor::message(ConnectionId sourceConnectionId, MessageContext::Mode mode, String const& channelName, String const& text, JsonObject data) { |
| 145 | RecursiveMutexLocker locker(m_mutex); |
| 146 | |
| 147 | ChatReceivedMessage message = { |
| 148 | {mode, channelName}, |
| 149 | sourceConnectionId, |
| 150 | connectionNick(sourceConnectionId), |
| 151 | text |
| 152 | }; |
| 153 | |
| 154 | message.data = std::move(data); |
| 155 | |
| 156 | if (handleCommand(message)) |
| 157 | return; |
| 158 | |
| 159 | for (auto clientId : m_channels[channelName]) { |
| 160 | auto& clientInfo = m_clients.get(clientId); |
| 161 | clientInfo.pendingMessages.append(message); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | void ChatProcessor::whisper(ConnectionId sourceConnectionId, ConnectionId targetClientId, String const& text, JsonObject data) { |
| 166 | RecursiveMutexLocker locker(m_mutex); |