Minor bug fixes

This commit is contained in:
WolverinDEV
2020-04-29 10:34:22 +02:00
parent dfd33eb674
commit cd8e2974f2
6 changed files with 146 additions and 10 deletions
+10 -7
View File
@@ -182,14 +182,17 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
client_channel_lock.lock();
}
deque<ChannelId> deleted;
for(const auto& update_entry : this->channels->update_channel_path(server_ref->channelTree->tree_head(), server_ref->channelTree->find_linked_entry(this->currentChannel->channelId()))) {
if(update_entry.first)
this->notifyChannelShow(update_entry.second->channel(), update_entry.second->previous_channel);
else deleted.push_back(update_entry.second->channelId());
/* might have been changed since we locked the tree */
if(this->currentChannel) {
deque<ChannelId> deleted;
for(const auto& update_entry : this->channels->update_channel_path(server_ref->channelTree->tree_head(), server_ref->channelTree->find_linked_entry(this->currentChannel->channelId()))) {
if(update_entry.first)
this->notifyChannelShow(update_entry.second->channel(), update_entry.second->previous_channel);
else deleted.push_back(update_entry.second->channelId());
}
if(!deleted.empty())
this->notifyChannelHide(deleted, false); /* we've locked the tree before */
}
if(!deleted.empty())
this->notifyChannelHide(deleted, false); /* we've locked the tree before */
}
}
+3 -3
View File
@@ -203,14 +203,14 @@ command_result ConnectedClient::handleCommandClientMove(Command &cmd) {
}
}
clients.emplace_back(std::move(target_client));
result.emplace_result(permission::ok);
result.emplace_result(error::ok);
}
if (!channel->properties()[property::CHANNEL_FLAG_MAXCLIENTS_UNLIMITED].as<bool>() || !channel->properties()[property::CHANNEL_FLAG_MAXFAMILYCLIENTS_UNLIMITED].as<bool>()) {
if(!permission::v2::permission_granted(1, this->calculate_permission(permission::b_channel_join_ignore_maxclients, channel->channelId()))) {
if(!channel->properties()[property::CHANNEL_FLAG_MAXCLIENTS_UNLIMITED].as<bool>()) {
auto maxClients = channel->properties()[property::CHANNEL_MAXCLIENTS].as<int32_t>();
if (maxClients >= 0 && maxClients <= this->server->getClientsByChannel(channel).size() + clients.size())
if (maxClients >= 0 && maxClients < this->server->getClientsByChannel(channel).size() + clients.size())
return command_result{error::channel_maxclients_reached};
}
if(!channel->properties()[property::CHANNEL_FLAG_MAXFAMILYCLIENTS_UNLIMITED].as<bool>()) {
@@ -227,7 +227,7 @@ command_result ConnectedClient::handleCommandClientMove(Command &cmd) {
for(const auto& entry : this->server->getClientsByChannelRoot(channel, false))
if(entry.get() != this) client_count++; //Dont count the client itself
if (maxClients >= 0 && maxClients <= client_count + clients.size())
if (maxClients >= 0 && maxClients < client_count + clients.size())
return command_result{error::channel_maxfamily_reached};
}
}
@@ -754,6 +754,9 @@ command_result ConnectedClient::handleCommandServerGroupDelClient(Command &cmd)
for(const auto& _server : target_server ? std::deque<shared_ptr<VirtualServer>>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) {
for (const auto &targetClient : _server->findClientsByCldbId(target_cldbid)) {
ConnectedLockedClient clock{targetClient};
if(!clock) continue;
if (_server->notifyClientPropertyUpdates(targetClient, _server->groups->update_server_group_property(targetClient, true, targetClient->getChannel()))) {
for (const auto &client : _server->getClients()) {
if(client->isClientVisible(targetClient, true) || client == targetClient)