Fixed a small bug

This commit is contained in:
WolverinDEV 2020-12-02 18:20:49 +01:00
parent a21a28fede
commit 64106c83eb
4 changed files with 17 additions and 5 deletions

@ -1 +1 @@
Subproject commit 2b3383c8419db53b6fe856194e62c38b7a24cd5c
Subproject commit 0bcc14c8eef4febba6e50bf089c84fbbe415bd95

View File

@ -642,6 +642,9 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
}
test_permission(1, permission::b_channel_create_child);
}
new_values[property::CHANNEL_PID] = cmd[key].string();
continue;
}
const auto &property = property::find<property::ChannelProperties>(key);
@ -731,10 +734,10 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
auto value = cmd["channel_flag_conversation_private"].as<bool>();
if (value) {
ACTION_REQUIRES_PERMISSION(permission::b_channel_create_modify_conversation_mode_private, 1, parent_channel_id);
cmd[property::name(property::CHANNEL_CONVERSATION_MODE)] = CHANNELCONVERSATIONMODE_PRIVATE;
new_values[property::CHANNEL_CONVERSATION_MODE] = std::to_string(CHANNELCONVERSATIONMODE_PRIVATE);
} else {
ACTION_REQUIRES_PERMISSION(permission::b_channel_create_modify_conversation_mode_public, 1, parent_channel_id);
cmd[property::name(property::CHANNEL_CONVERSATION_MODE)] = CHANNELCONVERSATIONMODE_PUBLIC;
new_values[property::CHANNEL_CONVERSATION_MODE] = std::to_string(CHANNELCONVERSATIONMODE_PUBLIC);
}
continue;
} else if (key == "channel_conversation_mode") {
@ -765,6 +768,11 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
new_values.emplace((property::ChannelProperties) property.property_index, cmd[key].string());
}
/* Fix since the default value of channel_flag_permanent is 1 which should be zero... */
if(!new_values.contains(property::CHANNEL_FLAG_PERMANENT)) {
new_values[property::CHANNEL_FLAG_PERMANENT] = std::to_string(false);
}
if (!cmd[0]["channel_flag_permanent"].as<bool>() && !this->server) {
return command_result{error::parameter_invalid, "You can only create a permanent channel"};
}

View File

@ -177,9 +177,13 @@ void VoiceClientConnection::callback_packet_decoded(void *ptr_this, const ts::pr
connection->handlePacketPong(packet);
break;
case protocol::INIT1:
/* We've received an init1 packet here. The connection should not send that kind of packets... */
break;
default:
assert(false);
logError(connection->virtual_server_id_, "{} Received hand decoded packet, but we've no method to handle it. Dropping packet.", connection->log_prefix());
assert(false);
break;
}
}

2
shared

@ -1 +1 @@
Subproject commit 5b74992beb5f4523485c8a4b6749c7dd6bbf282a
Subproject commit 2ba9288cc29f5be47a6862d5c1c3caec0bb6d377