diff --git a/src/Error.cpp b/src/Error.cpp index 43ac351..7300841 100644 --- a/src/Error.cpp +++ b/src/Error.cpp @@ -144,6 +144,9 @@ const std::vector ts::avariableErrors = { {0x2102, "playlist_already_in_use" , "playlist is already used by another bot" }, {0x2103, "playlist_is_in_use" , "playlist is used by another bot" }, + {0x2200, "conversation_invalid_id" , "invalid conversation id" }, + {0x2201, "conversation_more_data" , "there are more messages to send" }, + {0x1200, "query_not_exists" , "query account does not exists" }, {0x1201, "query_already_exists" , "query account already exists" }, diff --git a/src/PermissionManager.cpp b/src/PermissionManager.cpp index 5e713ae..80b78b9 100644 --- a/src/PermissionManager.cpp +++ b/src/PermissionManager.cpp @@ -121,6 +121,7 @@ deque> ts::permission::availablePermissions make_shared(PermissionType::b_channel_create_with_needed_talk_power, PermissionGroup::channel_create, "b_channel_create_with_needed_talk_power", "Create channels with needed talk power"), make_shared(PermissionType::b_channel_create_modify_with_force_password, PermissionGroup::channel_create, "b_channel_create_modify_with_force_password", "Create new channels only with password"), 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_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"), @@ -1184,11 +1185,16 @@ void v2::PermissionManager::set_permission(const PermissionType &permission, con data.values.grant = permNotGranted; /* required for the database else it does not "deletes" the value */ } - if(flag_skip >= 0) + if(flag_skip >= 0) { + data.flags.flag_value_update = true; data.flags.skip = flag_skip == 1; + } + + if(flag_negate >= 0) { + data.flags.flag_value_update = true; + data.flags.negate = flag_negate == 1; + } - if(flag_negate >= 0) - data.flags.skip = flag_negate == 1; this->unref_block(block); this->trigger_db_update(); } @@ -1248,11 +1254,15 @@ void v2::PermissionManager::set_channel_permission(const PermissionType &permiss permission_container->values.grant = permNotGranted; /* required for the database else it does not "deletes" the value */ } - if(flag_skip >= 0) + if(flag_skip >= 0) { + permission_container->flags.flag_value_update = true; permission_container->flags.skip = flag_skip == 1; + } - if(flag_negate >= 0) - permission_container->flags.skip = flag_negate == 1; + if(flag_negate >= 0) { + permission_container->flags.flag_value_update = true; + permission_container->flags.negate = flag_negate == 1; + } if(!permission_container->flags.permission_set()) { /* unregister the permission again because its unset, we delete the channel permission as soon we've flushed the updates */ auto other_channel_permission = std::find_if(this->_channel_permissions.begin(), this->_channel_permissions.end(), [&](unique_ptr& perm) { return perm->permission == permission && perm->flags.permission_set(); }); diff --git a/src/PermissionManager.h b/src/PermissionManager.h index d51bb23..36cdfe3 100644 --- a/src/PermissionManager.h +++ b/src/PermissionManager.h @@ -171,6 +171,7 @@ namespace ts { b_channel_create_with_needed_talk_power, b_channel_create_modify_with_force_password, i_channel_create_modify_with_temp_delete_delay, + i_channel_create_modify_conversation_history_length, /* channel::modify */ b_channel_modify_parent, diff --git a/src/Properties.cpp b/src/Properties.cpp index af2eb98..3cac25e 100644 --- a/src/Properties.cpp +++ b/src/Properties.cpp @@ -268,8 +268,9 @@ namespace ts { make_shared(CHANNEL_ICON_ID, "CHANNEL_ICON_ID", "0", TYPE_UNSIGNED_NUMBER, FLAG_CHANNEL_VIEW | FLAG_SS | FLAG_USER_EDITABLE), //Available for all channels that are "in view", always up-to-date make_shared(CHANNEL_FLAG_PRIVATE, "CHANNEL_FLAG_PRIVATE", "0", TYPE_BOOL, FLAG_CHANNEL_VIEW | FLAG_SS), //Available for all channels that are "in view", always up-to-date make_shared(CHANNEL_LAST_LEFT, "CHANNEL_LAST_LEFT", "0", TYPE_UNSIGNED_NUMBER, FLAG_SAVE | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW), //Available for all channels that are "in view", always up-to-date - make_shared(CHANNEL_CREATED_AT, "CHANNEL_CREATED_AT", "0", TYPE_UNSIGNED_NUMBER, FLAG_SAVE | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW), //Available for all channels that are "in view", always up-to-date - make_shared(CHANNEL_CREATED_BY, "CHANNEL_CREATED_BY", "0", TYPE_UNSIGNED_NUMBER, FLAG_SAVE | FLAG_CHANNEL_VIEW | FLAG_CHANNEL_VARIABLE | FLAG_NEW), //Available for all channels that are "in view", always up-to-date + make_shared(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 + make_shared(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 + make_shared(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) }; array, GroupProperties::GROUP_ENDMARKER> group_info = { diff --git a/src/Properties.h b/src/Properties.h index 7b89320..1f62a17 100644 --- a/src/Properties.h +++ b/src/Properties.h @@ -253,6 +253,8 @@ namespace ts { CHANNEL_CREATED_AT, CHANNEL_CREATED_BY, + CHANNEL_CONVERSATION_HISTORY_LENGTH, + CHANNEL_ENDMARKER };