Some minor bug fixes

This commit is contained in:
WolverinDEV 2020-06-25 18:15:15 +02:00
parent ce5d5c5cfa
commit b7953f5535
2 changed files with 3 additions and 4 deletions

View File

@ -69,9 +69,6 @@ command_result ConnectedClient::handleCommandClientKick(Command &cmd) {
auto type = cmd["reasonid"].as<ViewReasonId>();
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<ConnectedClient> client{this->server->find_client_by_id(cmd[index]["clid"].as<ClientId>())};
@ -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;

View File

@ -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<std::chrono::seconds>(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;
}