From b7953f5535c5a8048f6f96fd273db95d0e078112 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 25 Jun 2020 18:15:15 +0200 Subject: [PATCH] Some minor bug fixes --- server/src/client/command_handler/client.cpp | 5 ++--- server/src/client/command_handler/file.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index 441bd70..63318f4 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -69,9 +69,6 @@ command_result ConnectedClient::handleCommandClientKick(Command &cmd) { auto type = cmd["reasonid"].as(); auto target_channel = type == ViewReasonId::VREASON_CHANNEL_KICK ? this->server->channelTree->getDefaultChannel() : nullptr; - auto kick_power = type == ViewReasonId::VREASON_CHANNEL_KICK ? - this->calculate_permission(permission::i_client_kick_from_channel_power, target_channel->channelId()) : - this->calculate_permission(permission::i_client_kick_from_server_power, 0); for(size_t index = 0; index < cmd.bulkCount(); index++) { ConnectedLockedClient client{this->server->find_client_by_id(cmd[index]["clid"].as())}; @@ -86,11 +83,13 @@ command_result ConnectedClient::handleCommandClientKick(Command &cmd) { } if(type == ViewReasonId::VREASON_CHANNEL_KICK) { + auto kick_power = this->calculate_permission(permission::i_client_kick_from_channel_power, client->getChannelId()); if(!permission::v2::permission_granted(client->calculate_permission(permission::i_client_needed_kick_from_channel_power, client->getChannelId()), kick_power)) { result.emplace_result(permission::i_client_needed_kick_from_channel_power); continue; } } else { + auto kick_power = this->calculate_permission(permission::i_client_kick_from_server_power, client->getChannelId()); if(!permission::v2::permission_granted(client->calculate_permission(permission::i_client_needed_kick_from_server_power, client->getChannelId()), kick_power)) { result.emplace_result(permission::i_client_needed_kick_from_server_power); continue; diff --git a/server/src/client/command_handler/file.cpp b/server/src/client/command_handler/file.cpp index 5705e3c..0da9405 100644 --- a/server/src/client/command_handler/file.cpp +++ b/server/src/client/command_handler/file.cpp @@ -154,7 +154,7 @@ command_result ConnectedClient::handleCommandFTGetFileList(Command &cmd) { bulk.put_unchecked("size", file.size); bulk.put_unchecked("empty", file.empty); bulk.put_unchecked("datetime", std::chrono::duration_cast(file.modified_at.time_since_epoch()).count()); - if(bulk_index >= 16) { + if(bulk_index >= 16 && this->getType() != ClientType::CLIENT_QUERY) { this->sendCommand(notify_file_list); bulk_index = 0; }