Some minor fixes and added the listfeaturesupport command
This commit is contained in:
@@ -249,6 +249,8 @@ command_result ConnectedClient::handleCommand(Command &cmd) {
|
||||
else if (command == "conversationfetch") return this->handleCommandConversationFetch(cmd);
|
||||
else if (command == "conversationmessagedelete") return this->handleCommandConversationMessageDelete(cmd);
|
||||
|
||||
else if (command == "listfeaturesupport") return this->handleCommandListFeatureSupport(cmd);
|
||||
|
||||
if (this->getType() == ClientType::CLIENT_QUERY) return command_result{error::command_not_found}; //Dont log query invalid commands
|
||||
if (this->getType() == ClientType::CLIENT_TEAMSPEAK)
|
||||
if (command.empty() || command.find_first_not_of(' ') == -1) {
|
||||
@@ -2620,7 +2622,30 @@ command_result ConnectedClient::handleCommandConversationMessageDelete(ts::Comma
|
||||
return command_result{error::ok};
|
||||
}
|
||||
|
||||
|
||||
enum struct FeatureSupportMode {
|
||||
NONE,
|
||||
FULL,
|
||||
EXPERIMENTAL,
|
||||
DEPRECATED
|
||||
};
|
||||
|
||||
#define REGISTER_FEATURE(name, support, version) \
|
||||
notify.put_unchecked(index, "name", name); \
|
||||
notify.put_unchecked(index, "support", (int) support); \
|
||||
notify.put_unchecked(index, "version", version); \
|
||||
index++
|
||||
|
||||
command_result ConnectedClient::handleCommandListFeatureSupport(ts::Command &cmd) {
|
||||
|
||||
ts::command_builder notify{this->notify_response_command("notifyfeaturesupport")};
|
||||
int index{0};
|
||||
|
||||
REGISTER_FEATURE("error-bulks", FeatureSupportMode::FULL, 1);
|
||||
REGISTER_FEATURE("advanced-channel-chat", FeatureSupportMode::FULL, 1);
|
||||
|
||||
this->sendCommand(notify);
|
||||
return command_result{error::ok};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -347,6 +347,7 @@ command_result ConnectedClient::handleCommandServerGroupCopy(Command &cmd) {
|
||||
return permission::b_serverinstance_modify_querygroup;
|
||||
break;
|
||||
|
||||
case GroupType::GROUP_TYPE_NORMAL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -451,6 +452,7 @@ command_result ConnectedClient::handleCommandServerGroupDel(Command &cmd) {
|
||||
auto group_manager = this->server ? this->server->getGroupManager() : serverInstance->getGroupManager().get();
|
||||
auto serverGroup = group_manager->findGroup(cmd["sgid"].as<GroupId>());
|
||||
if (!serverGroup || serverGroup->target() != GROUPTARGET_SERVER) return command_result{error::group_invalid_id};
|
||||
ACTION_REQUIRES_GROUP_PERMISSION(serverGroup, permission::i_server_group_needed_modify_power, permission::i_server_group_modify_power, true);
|
||||
|
||||
if(this->server && this->server->properties()[property::VIRTUALSERVER_DEFAULT_SERVER_GROUP] == serverGroup->groupId())
|
||||
return command_result{error::parameter_invalid, "Could not delete default server group!"};
|
||||
@@ -784,12 +786,14 @@ command_result ConnectedClient::handleCommandServerGroupAddPerm(Command &cmd) {
|
||||
if (serverGroup->target() != GROUPTARGET_SERVER) return command_result{error::parameter_invalid};
|
||||
ACTION_REQUIRES_GROUP_PERMISSION(serverGroup, permission::i_server_group_needed_modify_power, permission::i_server_group_modify_power, 1);
|
||||
|
||||
/* We don't need this. The modify permissions only apply when creating/editing/renaming the groups itself
|
||||
auto type = serverGroup->type();
|
||||
if(type == GroupType::GROUP_TYPE_QUERY) {
|
||||
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_serverinstance_modify_querygroup, 1);
|
||||
} else if(type == GroupType::GROUP_TYPE_TEMPLATE) {
|
||||
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_serverinstance_modify_templates, 1);
|
||||
}
|
||||
*/
|
||||
|
||||
command::bulk_parser::PermissionBulksParser<true> pparser{cmd};
|
||||
if(!pparser.validate(this->ref(), 0))
|
||||
@@ -839,12 +843,14 @@ command_result ConnectedClient::handleCommandServerGroupDelPerm(Command &cmd) {
|
||||
if (serverGroup->target() != GROUPTARGET_SERVER) return command_result{error::parameter_invalid};
|
||||
ACTION_REQUIRES_GROUP_PERMISSION(serverGroup, permission::i_server_group_needed_modify_power, permission::i_server_group_modify_power, 1);
|
||||
|
||||
/* We don't need this. The modify permissions only apply when creating/editing/renaming the groups itself
|
||||
auto type = serverGroup->type();
|
||||
if(type == GroupType::GROUP_TYPE_QUERY) {
|
||||
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_serverinstance_modify_querygroup, 1);
|
||||
} else if(type == GroupType::GROUP_TYPE_TEMPLATE) {
|
||||
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_serverinstance_modify_templates, 1);
|
||||
}
|
||||
*/
|
||||
|
||||
command::bulk_parser::PermissionBulksParser<false> pparser{cmd};
|
||||
if(!pparser.validate(this->ref(), 0))
|
||||
|
||||
Reference in New Issue
Block a user