Merge branch '1.4.10-openssl' into 1.4.15

This commit is contained in:
WolverinDEV 2020-05-13 11:53:51 +02:00
commit 1d413f9b76
3 changed files with 12 additions and 5 deletions

@ -1 +1 @@
Subproject commit ee5090232867df795348b84f1c6d96561ea24d90 Subproject commit a8a0aabd7fca05b950de9f781a3cd6ba5b799f79

View File

@ -130,7 +130,6 @@ bool VirtualServer::initialize(bool test_properties) {
channelTree = new ServerChannelTree(self.lock(), this->sql); channelTree = new ServerChannelTree(self.lock(), this->sql);
channelTree->loadChannelsFromDatabase(); channelTree->loadChannelsFromDatabase();
channelTree->deleteSemiPermanentChannels();
this->groups = new GroupManager(self.lock(), this->sql, serverInstance->getGroupManager()); this->groups = new GroupManager(self.lock(), this->sql, serverInstance->getGroupManager());
if(!this->groups->loadGroupFormDatabase()){ //TODO exception etc if(!this->groups->loadGroupFormDatabase()){ //TODO exception etc
@ -138,6 +137,7 @@ bool VirtualServer::initialize(bool test_properties) {
return false; return false;
} }
channelTree->deleteSemiPermanentChannels();
if(channelTree->channel_count() == 0){ if(channelTree->channel_count() == 0){
logMessage(this->serverId, "Creating new channel tree (Copy from server 0)"); logMessage(this->serverId, "Creating new channel tree (Copy from server 0)");
LOG_SQL_CMD(sql::command(this->getSql(), "INSERT INTO `channels` (`serverId`, `channelId`, `type`, `parentId`) SELECT :serverId AS `serverId`, `channelId`, `type`, `parentId` FROM `channels` WHERE `serverId` = 0", variable{":serverId", this->serverId}).execute()); LOG_SQL_CMD(sql::command(this->getSql(), "INSERT INTO `channels` (`serverId`, `channelId`, `type`, `parentId`) SELECT :serverId AS `serverId`, `channelId`, `type`, `parentId` FROM `channels` WHERE `serverId` = 0", variable{":serverId", this->serverId}).execute());

View File

@ -100,8 +100,6 @@ command_result ConnectedClient::handleCommandClientKick(Command &cmd) {
clients.emplace_back(std::move(client)); clients.emplace_back(std::move(client));
result.emplace_result(error::ok); result.emplace_result(error::ok);
} }
if (clients.empty())
return command_result{error::database_empty_result};
for(auto& client : clients) { for(auto& client : clients) {
if (target_channel) { if (target_channel) {
@ -168,6 +166,7 @@ command_result ConnectedClient::handleCommandClientMove(Command &cmd) {
auto permission_cache = make_shared<CalculateCache>(); auto permission_cache = make_shared<CalculateCache>();
if(!cmd[0].has("cpw")) if(!cmd[0].has("cpw"))
cmd["cpw"] = ""; cmd["cpw"] = "";
if (!channel->passwordMatch(cmd["cpw"], true)) if (!channel->passwordMatch(cmd["cpw"], true))
if (!permission::v2::permission_granted(1, this->calculate_permission(permission::b_channel_join_ignore_password, channel->channelId()))) if (!permission::v2::permission_granted(1, this->calculate_permission(permission::b_channel_join_ignore_password, channel->channelId())))
return command_result{error::channel_invalid_password}; return command_result{error::channel_invalid_password};
@ -194,9 +193,17 @@ command_result ConnectedClient::handleCommandClientMove(Command &cmd) {
continue; continue;
} }
} }
if(target_client->getChannel() == channel) {
result.emplace_result(error::ok);
continue;
}
if(target_client.client != this) { if(target_client.client != this) {
if(!permission::v2::permission_granted(target_client->calculate_permission(permission::i_client_needed_move_power, 0), this->calculate_permission(permission::i_client_move_power, 0))) { if(!permission::v2::permission_granted(target_client->calculate_permission(permission::i_client_needed_move_power, target_client->getChannelId()), this->calculate_permission(permission::i_client_move_power, target_client->getChannelId()))) {
result.emplace_result(permission::i_client_move_power);
continue;
}
if(!permission::v2::permission_granted(target_client->calculate_permission(permission::i_client_needed_move_power, channel->channelId()), this->calculate_permission(permission::i_client_move_power, channel->channelId()))) {
result.emplace_result(permission::i_client_move_power); result.emplace_result(permission::i_client_move_power);
continue; continue;
} }