From 4c7a70bc81bc642b906dc16b7b93f65c7e8a24f0 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Fri, 4 Dec 2020 12:23:12 +0100 Subject: [PATCH] Some minor changes --- server/src/client/command_handler/client.cpp | 21 ++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index 3d999bd..f5d88ba 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -272,13 +272,19 @@ command_result ConnectedClient::handleCommandClientMove(Command &cmd) { } for(const auto& oldChannel : channels) { - if(!server_channel_w_lock.owns_lock()) + if(!server_channel_w_lock.owns_lock()) { server_channel_w_lock.lock(); - if(oldChannel->channelType() == ChannelType::temporary && oldChannel->properties()[property::CHANNEL_DELETE_DELAY].as() == 0) - if(this->server->getClientsByChannelRoot(oldChannel, false).empty()) + } + + if(oldChannel->channelType() == ChannelType::temporary && oldChannel->properties()[property::CHANNEL_DELETE_DELAY].as() == 0) { + if(this->server->getClientsByChannelRoot(oldChannel, false).empty()) { this->server->delete_channel(dynamic_pointer_cast(oldChannel), this->ref(), "temporary auto delete", server_channel_w_lock, true); - if(server_channel_w_lock.owns_lock()) + } + } + + if(server_channel_w_lock.owns_lock()) { server_channel_w_lock.unlock(); + } } return command_result{std::forward(result)}; } @@ -700,11 +706,14 @@ command_result ConnectedClient::handleCommandClientEdit(Command &cmd, const std: new_value ); } - if(update_talk_rights) + if(update_talk_rights) { client->updateTalkRights(client->calculate_permission(permission::i_client_talk_power, client->getChannelId())); + } - if(this->server) + if(this->server) { this->server->notifyClientPropertyUpdates(client, updates); + } + nickname_lock.reset(); return command_result{error::ok}; }