diff --git a/src/Definitions.h b/src/Definitions.h index ac318ab..dc61706 100644 --- a/src/Definitions.h +++ b/src/Definitions.h @@ -108,6 +108,12 @@ namespace ts { }; } + enum ChannelConversationMode : uint8_t { + CHANNELCONVERSATIONMODE_PUBLIC = 0, + CHANNELCONVERSATIONMODE_PRIVATE = 1, + CHANNELCONVERSATIONMODE_NONE = 2 + }; + enum QueryEventGroup : int { QEVENTGROUP_MIN = 0, QEVENTGROUP_SERVER = 0, @@ -167,6 +173,7 @@ DEFINE_TRANSFORMS(ts::LicenseType, uint8_t); DEFINE_TRANSFORMS(ts::PluginTargetMode, uint8_t); DEFINE_TRANSFORMS(ts::ViewReasonId, uint8_t); DEFINE_TRANSFORMS(ts::ChatMessageMode, uint8_t); +DEFINE_TRANSFORMS(ts::ChannelConversationMode, uint8_t); #ifdef WIN32 #define ts_always_inline __forceinline diff --git a/src/Error.cpp b/src/Error.cpp index e9b92b7..c22ddd0 100644 --- a/src/Error.cpp +++ b/src/Error.cpp @@ -179,6 +179,7 @@ const std::vector ts::avariableErrors = { {0x2200, "conversation_invalid_id" , "invalid conversation id" }, {0x2201, "conversation_more_data" , "there are more messages to send" }, {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" }, {0x1201, "query_already_exists" , "query account already exists" }, diff --git a/src/Error.h b/src/Error.h index 27e7c63..36b0c02 100644 --- a/src/Error.h +++ b/src/Error.h @@ -191,6 +191,7 @@ namespace ts { conversation_invalid_id = 0x2200, conversation_more_data = 0x2201, conversation_is_private = 0x2202, + conversation_not_exists = 0x2203, custom_error = 0xffff }; diff --git a/src/PermissionManager.cpp b/src/PermissionManager.cpp index e1e099c..e96c18a 100644 --- a/src/PermissionManager.cpp +++ b/src/PermissionManager.cpp @@ -125,7 +125,10 @@ deque> ts::permission::availablePermissions make_shared(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(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(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(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(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(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(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(PermissionType::b_channel_modify_parent, PermissionGroup::channel_modify, "b_channel_modify_parent", "Move channels"), make_shared(PermissionType::b_channel_modify_make_default, PermissionGroup::channel_modify, "b_channel_modify_make_default", "Make channel default"), make_shared(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, i_channel_create_modify_conversation_history_length, 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_password, b_channel_modify_topic, diff --git a/src/PermissionManager.h b/src/PermissionManager.h index 38239bc..87c7664 100644 --- a/src/PermissionManager.h +++ b/src/PermissionManager.h @@ -179,7 +179,9 @@ namespace ts { i_channel_create_modify_with_temp_delete_delay, i_channel_create_modify_conversation_history_length, 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 */ b_channel_modify_parent, @@ -493,7 +495,7 @@ namespace ts { channel = i_channel_needed_permission_modify_power, 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_delete = i_channel_needed_delete_power, channel_access = b_channel_ignore_description_view_power, diff --git a/src/Properties.h b/src/Properties.h index 9072e70..7d49c79 100644 --- a/src/Properties.h +++ b/src/Properties.h @@ -38,13 +38,14 @@ namespace ts { PROP_TYPE_MAX }; - static constexpr const char *PropertyType_Names[7] = { + static constexpr const char *PropertyType_Names[8] = { "SERVER", "CHANNEL", "GROUP", "CLIENT", "INSTANCE", "CONNECTION", + "PLAYLIST", "UNKNOWN" }; @@ -57,6 +58,15 @@ namespace ts { TYPE_FLOAT }; + static constexpr const char *ValueType_Names[6] = { + "UNKNOWN", + "STRING", + "BOOL", + "SIGNED_NUMBER", + "UNSIGNED_NUMBER", + "FLOAT" + }; + typedef uint32_t flag_type; enum flag : flag_type { FLAG_BEGIN = 0b1, @@ -270,7 +280,7 @@ namespace ts { CHANNEL_CREATED_BY, CHANNEL_CONVERSATION_HISTORY_LENGTH, - CHANNEL_FLAG_CONVERSATION_PRIVATE, + CHANNEL_CONVERSATION_MODE, CHANNEL_ENDMARKER }; @@ -664,7 +674,13 @@ namespace ts { const auto begin = property_list_info.begin_index[type]; const auto end = property_list_info.end_index[type]; - return {property_list.begin() + begin, property_list.begin() + end}; + + std::vector result{}; + result.reserve(end - begin); + for(size_t index{begin}; index < end; index++) { + result.push_back(&property_list[index]); + } + return result; } template ::value, int>::type = 0> diff --git a/src/PropertyDefinition.h b/src/PropertyDefinition.h index 6fbb940..034f995 100644 --- a/src/PropertyDefinition.h +++ b/src/PropertyDefinition.h @@ -149,7 +149,7 @@ property_list = std::array{ 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_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 */ PropertyDescription{GROUP_UNDEFINED, "undefined", "", TYPE_UNKNOWN, 0},