Fixed chat send issue

This commit is contained in:
WolverinDEV 2020-02-04 18:09:47 +01:00
parent 8021c3f334
commit 14d9936d90

View File

@ -1176,11 +1176,11 @@ void VirtualServer::ensureValidDefaultGroups() {
} }
} }
void VirtualServer::send_text_message(const std::shared_ptr<BasicChannel> &channel, const std::shared_ptr<ConnectedClient> &client, const std::string &message) { void VirtualServer::send_text_message(const std::shared_ptr<BasicChannel> &channel, const std::shared_ptr<ConnectedClient> &sender, const std::string &message) {
assert(channel); assert(channel);
assert(client); assert(sender);
auto client_id = client->getClientId(); auto client_id = sender->getClientId();
auto channel_id = channel->channelId(); auto channel_id = channel->channelId();
auto now = chrono::system_clock::now(); auto now = chrono::system_clock::now();
@ -1206,13 +1206,13 @@ void VirtualServer::send_text_message(const std::shared_ptr<BasicChannel> &chann
if(!client->calculate_and_get_join_state(channel)) if(!client->calculate_and_get_join_state(channel))
continue; continue;
} }
client->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, client, client_id, channel_id, now, message); client->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, sender, client_id, channel_id, now, message);
} }
} }
if(!conversation_private) { if(!conversation_private) {
auto conversations = this->conversation_manager(); auto conversations = this->conversation_manager();
auto conversation = conversations->get_or_create(channel->channelId()); auto conversation = conversations->get_or_create(channel->channelId());
conversation->register_message(client->getClientDatabaseId(), client->getUid(), this->getDisplayName(), now, message); conversation->register_message(sender->getClientDatabaseId(), sender->getUid(), this->getDisplayName(), now, message);
} }
} }