Updated the property list command and added a channel description only mode

This commit is contained in:
WolverinDEV 2020-10-04 15:04:23 +02:00
parent 0a960e4148
commit f5c643129e
7 changed files with 40 additions and 8 deletions

View File

@ -108,6 +108,12 @@ namespace ts {
}; };
} }
enum ChannelConversationMode : uint8_t {
CHANNELCONVERSATIONMODE_PUBLIC = 0,
CHANNELCONVERSATIONMODE_PRIVATE = 1,
CHANNELCONVERSATIONMODE_NONE = 2
};
enum QueryEventGroup : int { enum QueryEventGroup : int {
QEVENTGROUP_MIN = 0, QEVENTGROUP_MIN = 0,
QEVENTGROUP_SERVER = 0, QEVENTGROUP_SERVER = 0,
@ -167,6 +173,7 @@ DEFINE_TRANSFORMS(ts::LicenseType, uint8_t);
DEFINE_TRANSFORMS(ts::PluginTargetMode, uint8_t); DEFINE_TRANSFORMS(ts::PluginTargetMode, uint8_t);
DEFINE_TRANSFORMS(ts::ViewReasonId, uint8_t); DEFINE_TRANSFORMS(ts::ViewReasonId, uint8_t);
DEFINE_TRANSFORMS(ts::ChatMessageMode, uint8_t); DEFINE_TRANSFORMS(ts::ChatMessageMode, uint8_t);
DEFINE_TRANSFORMS(ts::ChannelConversationMode, uint8_t);
#ifdef WIN32 #ifdef WIN32
#define ts_always_inline __forceinline #define ts_always_inline __forceinline

View File

@ -179,6 +179,7 @@ const std::vector<ErrorType> ts::avariableErrors = {
{0x2200, "conversation_invalid_id" , "invalid conversation id" }, {0x2200, "conversation_invalid_id" , "invalid conversation id" },
{0x2201, "conversation_more_data" , "there are more messages to send" }, {0x2201, "conversation_more_data" , "there are more messages to send" },
{0x2202, "conversation_is_private" , "the target conversation is private" }, {0x2202, "conversation_is_private" , "the target conversation is private" },
{0x2203, "conversation_not_exists" , "the target conversation does not exists" },
{0x1200, "query_not_exists" , "query account does not exists" }, {0x1200, "query_not_exists" , "query account does not exists" },
{0x1201, "query_already_exists" , "query account already exists" }, {0x1201, "query_already_exists" , "query account already exists" },

View File

@ -191,6 +191,7 @@ namespace ts {
conversation_invalid_id = 0x2200, conversation_invalid_id = 0x2200,
conversation_more_data = 0x2201, conversation_more_data = 0x2201,
conversation_is_private = 0x2202, conversation_is_private = 0x2202,
conversation_not_exists = 0x2203,
custom_error = 0xffff custom_error = 0xffff
}; };

View File

@ -125,7 +125,10 @@ deque<std::shared_ptr<PermissionTypeEntry>> ts::permission::availablePermissions
make_shared<PermissionTypeEntry>(PermissionType::i_channel_create_modify_with_temp_delete_delay, PermissionGroup::channel_create, "i_channel_create_modify_with_temp_delete_delay", "Max delete delay for temporary channels"), make_shared<PermissionTypeEntry>(PermissionType::i_channel_create_modify_with_temp_delete_delay, PermissionGroup::channel_create, "i_channel_create_modify_with_temp_delete_delay", "Max delete delay for temporary channels"),
make_shared<PermissionTypeEntry>(PermissionType::i_channel_create_modify_conversation_history_length, PermissionGroup::channel_create, "i_channel_create_modify_conversation_history_length", "Upper limmit for the setting of the max conversation history limit"), make_shared<PermissionTypeEntry>(PermissionType::i_channel_create_modify_conversation_history_length, PermissionGroup::channel_create, "i_channel_create_modify_conversation_history_length", "Upper limmit for the setting of the max conversation history limit"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_create_modify_conversation_history_unlimited, PermissionGroup::channel_create, "b_channel_create_modify_conversation_history_unlimited", "Allows the user to set the channel conversation history to unlimited"), make_shared<PermissionTypeEntry>(PermissionType::b_channel_create_modify_conversation_history_unlimited, PermissionGroup::channel_create, "b_channel_create_modify_conversation_history_unlimited", "Allows the user to set the channel conversation history to unlimited"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_create_modify_conversation_private, PermissionGroup::channel_create, "b_channel_create_modify_conversation_private", "Allows the user to set the channel conversation to private"), make_shared<PermissionTypeEntry>(PermissionType::b_channel_create_modify_conversation_mode_public, PermissionGroup::channel_create, "b_channel_create_modify_conversation_mode_public", "Allows the user to set the channel conversation mode to public"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_create_modify_conversation_mode_private, PermissionGroup::channel_create, "b_channel_create_modify_conversation_mode_private", "Allows the user to set the channel conversation mode to private"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_create_modify_conversation_mode_none, PermissionGroup::channel_create, "b_channel_create_modify_conversation_mode_none", "Allows the user to set the channel conversation mode to none"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_modify_parent, PermissionGroup::channel_modify, "b_channel_modify_parent", "Move channels"), make_shared<PermissionTypeEntry>(PermissionType::b_channel_modify_parent, PermissionGroup::channel_modify, "b_channel_modify_parent", "Move channels"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_modify_make_default, PermissionGroup::channel_modify, "b_channel_modify_make_default", "Make channel default"), make_shared<PermissionTypeEntry>(PermissionType::b_channel_modify_make_default, PermissionGroup::channel_modify, "b_channel_modify_make_default", "Make channel default"),
make_shared<PermissionTypeEntry>(PermissionType::b_channel_modify_make_permanent, PermissionGroup::channel_modify, "b_channel_modify_make_permanent", "Make channel permanent"), make_shared<PermissionTypeEntry>(PermissionType::b_channel_modify_make_permanent, PermissionGroup::channel_modify, "b_channel_modify_make_permanent", "Make channel permanent"),
@ -477,7 +480,9 @@ i_group_modify_power,
b_virtualserver_modify_default_messages, b_virtualserver_modify_default_messages,
i_channel_create_modify_conversation_history_length, i_channel_create_modify_conversation_history_length,
b_channel_create_modify_conversation_history_unlimited, b_channel_create_modify_conversation_history_unlimited,
b_channel_create_modify_conversation_private, b_channel_create_modify_conversation_mode_public,
b_channel_create_modify_conversation_mode_private,
b_channel_create_modify_conversation_mode_none,
b_channel_modify_name, b_channel_modify_name,
b_channel_modify_password, b_channel_modify_password,
b_channel_modify_topic, b_channel_modify_topic,

View File

@ -179,7 +179,9 @@ namespace ts {
i_channel_create_modify_with_temp_delete_delay, i_channel_create_modify_with_temp_delete_delay,
i_channel_create_modify_conversation_history_length, i_channel_create_modify_conversation_history_length,
b_channel_create_modify_conversation_history_unlimited, b_channel_create_modify_conversation_history_unlimited,
b_channel_create_modify_conversation_private, b_channel_create_modify_conversation_mode_private,
b_channel_create_modify_conversation_mode_public,
b_channel_create_modify_conversation_mode_none,
/* channel::modify */ /* channel::modify */
b_channel_modify_parent, b_channel_modify_parent,
@ -493,7 +495,7 @@ namespace ts {
channel = i_channel_needed_permission_modify_power, channel = i_channel_needed_permission_modify_power,
channel_info = b_virtualserver_channel_permission_list, channel_info = b_virtualserver_channel_permission_list,
channel_create = b_channel_create_modify_conversation_private, channel_create = b_channel_create_modify_conversation_mode_none,
channel_modify = b_channel_modify_temp_delete_delay, channel_modify = b_channel_modify_temp_delete_delay,
channel_delete = i_channel_needed_delete_power, channel_delete = i_channel_needed_delete_power,
channel_access = b_channel_ignore_description_view_power, channel_access = b_channel_ignore_description_view_power,

View File

@ -38,13 +38,14 @@ namespace ts {
PROP_TYPE_MAX PROP_TYPE_MAX
}; };
static constexpr const char *PropertyType_Names[7] = { static constexpr const char *PropertyType_Names[8] = {
"SERVER", "SERVER",
"CHANNEL", "CHANNEL",
"GROUP", "GROUP",
"CLIENT", "CLIENT",
"INSTANCE", "INSTANCE",
"CONNECTION", "CONNECTION",
"PLAYLIST",
"UNKNOWN" "UNKNOWN"
}; };
@ -57,6 +58,15 @@ namespace ts {
TYPE_FLOAT TYPE_FLOAT
}; };
static constexpr const char *ValueType_Names[6] = {
"UNKNOWN",
"STRING",
"BOOL",
"SIGNED_NUMBER",
"UNSIGNED_NUMBER",
"FLOAT"
};
typedef uint32_t flag_type; typedef uint32_t flag_type;
enum flag : flag_type { enum flag : flag_type {
FLAG_BEGIN = 0b1, FLAG_BEGIN = 0b1,
@ -270,7 +280,7 @@ namespace ts {
CHANNEL_CREATED_BY, CHANNEL_CREATED_BY,
CHANNEL_CONVERSATION_HISTORY_LENGTH, CHANNEL_CONVERSATION_HISTORY_LENGTH,
CHANNEL_FLAG_CONVERSATION_PRIVATE, CHANNEL_CONVERSATION_MODE,
CHANNEL_ENDMARKER CHANNEL_ENDMARKER
}; };
@ -664,7 +674,13 @@ namespace ts {
const auto begin = property_list_info.begin_index[type]; const auto begin = property_list_info.begin_index[type];
const auto end = property_list_info.end_index[type]; const auto end = property_list_info.end_index[type];
return {property_list.begin() + begin, property_list.begin() + end};
std::vector<const PropertyDescription*> result{};
result.reserve(end - begin);
for(size_t index{begin}; index < end; index++) {
result.push_back(&property_list[index]);
}
return result;
} }
template <typename PropertyEnumType, typename std::enable_if<std::is_enum<PropertyEnumType>::value, int>::type = 0> template <typename PropertyEnumType, typename std::enable_if<std::is_enum<PropertyEnumType>::value, int>::type = 0>

View File

@ -149,7 +149,7 @@ property_list = std::array<PropertyDescription, impl::property_count()>{
PropertyDescription{CHANNEL_CREATED_AT, "channel_created_at", "0", TYPE_UNSIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW}, //Available for all channels that are "in view", always up-to-date PropertyDescription{CHANNEL_CREATED_AT, "channel_created_at", "0", TYPE_UNSIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW}, //Available for all channels that are "in view", always up-to-date
PropertyDescription{CHANNEL_CREATED_BY, "channel_created_by", "0", TYPE_UNSIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW}, //Available for all channels that are "in view", always up-to-date PropertyDescription{CHANNEL_CREATED_BY, "channel_created_by", "0", TYPE_UNSIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW}, //Available for all channels that are "in view", always up-to-date
PropertyDescription{CHANNEL_CONVERSATION_HISTORY_LENGTH, "channel_conversation_history_length", "1500", TYPE_SIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW | FLAG_USER_EDITABLE}, PropertyDescription{CHANNEL_CONVERSATION_HISTORY_LENGTH, "channel_conversation_history_length", "1500", TYPE_SIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW | FLAG_USER_EDITABLE},
PropertyDescription{CHANNEL_FLAG_CONVERSATION_PRIVATE, "channel_flag_conversation_private", "0", TYPE_BOOL, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW | FLAG_USER_EDITABLE}, PropertyDescription{CHANNEL_CONVERSATION_MODE, "channel_conversation_mode", "1", TYPE_UNSIGNED_NUMBER, FLAG_SS | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW | FLAG_USER_EDITABLE},
/* group properties, this may gets removed */ /* group properties, this may gets removed */
PropertyDescription{GROUP_UNDEFINED, "undefined", "", TYPE_UNKNOWN, 0}, PropertyDescription{GROUP_UNDEFINED, "undefined", "", TYPE_UNKNOWN, 0},