From 364b3781b1b374fdbb90cc19a4c247163715bd8d Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 3 Dec 2020 10:49:21 +0100 Subject: [PATCH] Added a new channel property --- git-teaspeak | 2 +- server/src/InstanceHandlerSetup.cpp | 3 ++- server/src/client/command_handler/channel.cpp | 15 +++++++++++++++ shared | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/git-teaspeak b/git-teaspeak index 0bcc14c..c8eb58e 160000 --- a/git-teaspeak +++ b/git-teaspeak @@ -1 +1 @@ -Subproject commit 0bcc14c8eef4febba6e50bf089c84fbbe415bd95 +Subproject commit c8eb58e3b1486e8d5ea8943562bf8e94afa0b37a diff --git a/server/src/InstanceHandlerSetup.cpp b/server/src/InstanceHandlerSetup.cpp index b883f36..95bf060 100644 --- a/server/src/InstanceHandlerSetup.cpp +++ b/server/src/InstanceHandlerSetup.cpp @@ -128,8 +128,9 @@ bool InstanceHandler::setupDefaultGroups() { info->target == 0 ? GroupType::GROUP_TYPE_QUERY : GroupType::GROUP_TYPE_TEMPLATE, info->name ); + for(auto perm : info->permissions) { - group->permissions()->set_permission(get<0>(perm), {get<1>(perm), get<2>(perm)}, permission::v2::set_value, permission::v2::set_value, get<3>(perm), get<4>(perm)); + group->permissions()->set_permission(get<0>(perm), {get<1>(perm), get<2>(perm)}, get<1>(perm) == permNotGranted ? permission::v2::do_nothing : permission::v2::set_value, get<2>(perm) == permNotGranted ? permission::v2::do_nothing : permission::v2::set_value, get<3>(perm), get<4>(perm)); } for(const auto& property : info->properties) { diff --git a/server/src/client/command_handler/channel.cpp b/server/src/client/command_handler/channel.cpp index 0aebe8b..57e5d99 100644 --- a/server/src/client/command_handler/channel.cpp +++ b/server/src/client/command_handler/channel.cpp @@ -1119,6 +1119,8 @@ command_result ConnectedClient::handleCommandChannelEdit(Command &cmd) { default: return command_result{error::parameter_invalid, "channel_conversation_mode"}; } + } else if(key == "channel_sidebar_mode") { + ACTION_REQUIRES_PERMISSION(permission::b_channel_create_modify_sidebar_mode, 1, channel_id); } else { logCritical( this->getServerId(), @@ -1283,6 +1285,19 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id, break; } + case property::CHANNEL_SIDEBAR_MODE: { + switch (converter::from_string_view(value)) { + case ChannelSidebarMode::CHANNELSIDEBARMODE_CONVERSATION: + case ChannelSidebarMode::CHANNELSIDEBARMODE_DESCRIPTION: + case ChannelSidebarMode::CHANNELSIDEBARMODE_FILE_TRANSFER: + break; + + default: + return command_result{error::parameter_invalid, std::string{property::describe(property).name}}; + } + break; + } + /* non editable properties */ case property::CHANNEL_FLAG_ARE_SUBSCRIBED: case property::CHANNEL_FORCED_SILENCE: diff --git a/shared b/shared index 3eedb7d..b271cdd 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 3eedb7d77220145b01f3fc7f11e32656b532dcbd +Subproject commit b271cdd6ff2336512b337e8dfd4896b290454c2c