First implementation for the conversation system (not 100% finished yet)
This commit is contained in:
parent
9833dab6e4
commit
d9ddc2c06d
@ -144,6 +144,9 @@ const std::vector<ErrorType> ts::avariableErrors = {
|
|||||||
{0x2102, "playlist_already_in_use" , "playlist is already used by another bot" },
|
{0x2102, "playlist_already_in_use" , "playlist is already used by another bot" },
|
||||||
{0x2103, "playlist_is_in_use" , "playlist is 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" },
|
{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" },
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ deque<std::shared_ptr<PermissionTypeEntry>> ts::permission::availablePermissions
|
|||||||
make_shared<PermissionTypeEntry>(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<PermissionTypeEntry>(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<PermissionTypeEntry>(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<PermissionTypeEntry>(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<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::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"),
|
||||||
@ -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 */
|
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;
|
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->unref_block(block);
|
||||||
this->trigger_db_update();
|
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 */
|
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;
|
permission_container->flags.skip = flag_skip == 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(flag_negate >= 0)
|
if(flag_negate >= 0) {
|
||||||
permission_container->flags.skip = flag_negate == 1;
|
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 */
|
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<ChannelPermissionContainer>& perm) { return perm->permission == permission && perm->flags.permission_set(); });
|
auto other_channel_permission = std::find_if(this->_channel_permissions.begin(), this->_channel_permissions.end(), [&](unique_ptr<ChannelPermissionContainer>& perm) { return perm->permission == permission && perm->flags.permission_set(); });
|
||||||
|
@ -171,6 +171,7 @@ namespace ts {
|
|||||||
b_channel_create_with_needed_talk_power,
|
b_channel_create_with_needed_talk_power,
|
||||||
b_channel_create_modify_with_force_password,
|
b_channel_create_modify_with_force_password,
|
||||||
i_channel_create_modify_with_temp_delete_delay,
|
i_channel_create_modify_with_temp_delete_delay,
|
||||||
|
i_channel_create_modify_conversation_history_length,
|
||||||
|
|
||||||
/* channel::modify */
|
/* channel::modify */
|
||||||
b_channel_modify_parent,
|
b_channel_modify_parent,
|
||||||
|
@ -268,8 +268,9 @@ namespace ts {
|
|||||||
make_shared<PropertyDescription>(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<PropertyDescription>(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<PropertyDescription>(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<PropertyDescription>(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<PropertyDescription>(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<PropertyDescription>(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<PropertyDescription>(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<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
|
||||||
make_shared<PropertyDescription>(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<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
|
||||||
|
make_shared<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)
|
||||||
};
|
};
|
||||||
|
|
||||||
array<shared_ptr<PropertyDescription>, GroupProperties::GROUP_ENDMARKER> group_info = {
|
array<shared_ptr<PropertyDescription>, GroupProperties::GROUP_ENDMARKER> group_info = {
|
||||||
|
@ -253,6 +253,8 @@ namespace ts {
|
|||||||
CHANNEL_CREATED_AT,
|
CHANNEL_CREATED_AT,
|
||||||
CHANNEL_CREATED_BY,
|
CHANNEL_CREATED_BY,
|
||||||
|
|
||||||
|
CHANNEL_CONVERSATION_HISTORY_LENGTH,
|
||||||
|
|
||||||
CHANNEL_ENDMARKER
|
CHANNEL_ENDMARKER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user