Rename allow_saving_content to has_private_content.
This commit is contained in:
parent
ecc8889cac
commit
831ca4b975
@ -966,7 +966,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
|||||||
//@last_message Last message in the chat; may be null
|
//@last_message Last message in the chat; may be null
|
||||||
//@positions Positions of the chat in chat lists
|
//@positions Positions of the chat in chat lists
|
||||||
//@default_message_sender_id Default identifier of a user or chat that is chosen to send messages in the chat; may be null if the user can't change message sender
|
//@default_message_sender_id Default identifier of a user or chat that is chosen to send messages in the chat; may be null if the user can't change message sender
|
||||||
//@allow_saving_content True, if chat content can be saved locally, forwarded, or copied
|
//@has_protected_content True, if chat content can't be saved locally, forwarded, or copied
|
||||||
//@is_marked_as_unread True, if the chat is marked as unread
|
//@is_marked_as_unread True, if the chat is marked as unread
|
||||||
//@is_blocked True, if the chat is blocked by the current user and private messages from the chat can't be received
|
//@is_blocked True, if the chat is blocked by the current user and private messages from the chat can't be received
|
||||||
//@has_scheduled_messages True, if the chat has scheduled messages
|
//@has_scheduled_messages True, if the chat has scheduled messages
|
||||||
@ -987,7 +987,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
|||||||
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
||||||
//@draft_message A draft of a message in the chat; may be null
|
//@draft_message A draft of a message in the chat; may be null
|
||||||
//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
||||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> default_message_sender_id:MessageSender allow_saving_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> default_message_sender_id:MessageSender has_protected_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||||
|
|
||||||
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
|
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
|
||||||
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
||||||
@ -2603,8 +2603,8 @@ chatEventMessageTtlSettingChanged old_message_ttl_setting:int32 new_message_ttl_
|
|||||||
//@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages
|
//@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages
|
||||||
chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction;
|
chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction;
|
||||||
|
|
||||||
//@description The allow_saving_content setting of a channel was toggled @allow_saving_content New value of allow_saving_content
|
//@description The has_protected_content setting of a channel was toggled @has_protected_content New value of has_protected_content
|
||||||
chatEventAllowSavingContentToggled allow_saving_content:Bool = ChatEventAction;
|
chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction;
|
||||||
|
|
||||||
//@description The supergroup sticker set was changed @old_sticker_set_id Previous identifier of the chat sticker set; 0 if none @new_sticker_set_id New identifier of the chat sticker set; 0 if none
|
//@description The supergroup sticker set was changed @old_sticker_set_id Previous identifier of the chat sticker set; 0 if none @new_sticker_set_id New identifier of the chat sticker set; 0 if none
|
||||||
chatEventStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction;
|
chatEventStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction;
|
||||||
@ -3731,8 +3731,8 @@ updateChatPosition chat_id:int53 position:chatPosition = Update;
|
|||||||
//@description The default message sender that is chosen to send messages in a chat has changed @chat_id Chat identifier @default_message_sender_id New value of default_message_sender_id; may be null if the user can't change message sender
|
//@description The default message sender that is chosen to send messages in a chat has changed @chat_id Chat identifier @default_message_sender_id New value of default_message_sender_id; may be null if the user can't change message sender
|
||||||
updateChatDefaultMessageSenderId chat_id:int53 default_message_sender_id:MessageSender = Update;
|
updateChatDefaultMessageSenderId chat_id:int53 default_message_sender_id:MessageSender = Update;
|
||||||
|
|
||||||
//@description A chat content was allowed or restricted for saving @chat_id Chat identifier @allow_saving_content New value of allow_saving_content
|
//@description A chat content was allowed or restricted for saving @chat_id Chat identifier @has_protected_content New value of has_protected_content
|
||||||
updateChatAllowSavingContent chat_id:int53 allow_saving_content:Bool = Update;
|
updateChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Update;
|
||||||
|
|
||||||
//@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread
|
//@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread
|
||||||
updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update;
|
updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update;
|
||||||
@ -4790,8 +4790,8 @@ setChatDraftMessage chat_id:int53 message_thread_id:int53 draft_message:draftMes
|
|||||||
setChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Ok;
|
setChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Ok;
|
||||||
|
|
||||||
//@description Changes the ability of users to save, forward, or copy chat content. Supported only for basic groups, supergroups and channels. Requires owner privileges
|
//@description Changes the ability of users to save, forward, or copy chat content. Supported only for basic groups, supergroups and channels. Requires owner privileges
|
||||||
//@chat_id Chat identifier @allow_saving_content True, if chat content can be saved locally, forwarded, or copied
|
//@chat_id Chat identifier @has_protected_content True, if chat content can't be saved locally, forwarded, or copied
|
||||||
toggleChatAllowSavingContent chat_id:int53 allow_saving_content:Bool = Ok;
|
toggleChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Ok;
|
||||||
|
|
||||||
//@description Changes the marked as unread state of a chat @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread
|
//@description Changes the marked as unread state of a chat @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread
|
||||||
toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok;
|
toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok;
|
||||||
|
@ -4676,20 +4676,20 @@ RestrictedRights ContactsManager::get_secret_chat_default_permissions(SecretChat
|
|||||||
return RestrictedRights(true, true, true, true, true, true, true, true, false, false, false);
|
return RestrictedRights(true, true, true, true, true, true, true, true, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContactsManager::get_chat_allow_saving_content(ChatId chat_id) const {
|
bool ContactsManager::get_chat_has_protected_content(ChatId chat_id) const {
|
||||||
auto c = get_chat(chat_id);
|
auto c = get_chat(chat_id);
|
||||||
if (c == nullptr) {
|
if (c == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !c->noforwards;
|
return c->noforwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContactsManager::get_channel_allow_saving_content(ChannelId channel_id) const {
|
bool ContactsManager::get_channel_has_protected_content(ChannelId channel_id) const {
|
||||||
auto c = get_channel(channel_id);
|
auto c = get_channel(channel_id);
|
||||||
if (c == nullptr) {
|
if (c == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !c->noforwards;
|
return c->noforwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ContactsManager::get_user_private_forward_name(UserId user_id) {
|
string ContactsManager::get_user_private_forward_name(UserId user_id) {
|
||||||
@ -9937,7 +9937,7 @@ void ContactsManager::update_chat(Chat *c, ChatId chat_id, bool from_binlog, boo
|
|||||||
c->is_status_changed = false;
|
c->is_status_changed = false;
|
||||||
}
|
}
|
||||||
if (c->is_noforwards_changed) {
|
if (c->is_noforwards_changed) {
|
||||||
td_->messages_manager_->on_dialog_allow_saving_content_updated(DialogId(chat_id));
|
td_->messages_manager_->on_dialog_has_protected_content_updated(DialogId(chat_id));
|
||||||
c->is_noforwards_changed = false;
|
c->is_noforwards_changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10031,7 +10031,7 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
|
|||||||
c->is_creator_changed = false;
|
c->is_creator_changed = false;
|
||||||
}
|
}
|
||||||
if (c->is_noforwards_changed) {
|
if (c->is_noforwards_changed) {
|
||||||
td_->messages_manager_->on_dialog_allow_saving_content_updated(DialogId(channel_id));
|
td_->messages_manager_->on_dialog_has_protected_content_updated(DialogId(channel_id));
|
||||||
c->is_noforwards_changed = false;
|
c->is_noforwards_changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13085,7 +13085,7 @@ void ContactsManager::on_update_chat_default_permissions(Chat *c, ChatId chat_id
|
|||||||
|
|
||||||
void ContactsManager::on_update_chat_noforwards(Chat *c, ChatId chat_id, bool noforwards) {
|
void ContactsManager::on_update_chat_noforwards(Chat *c, ChatId chat_id, bool noforwards) {
|
||||||
if (c->noforwards != noforwards) {
|
if (c->noforwards != noforwards) {
|
||||||
LOG(INFO) << "Update " << chat_id << " noforwards from " << c->noforwards << " to " << noforwards;
|
LOG(INFO) << "Update " << chat_id << " has_protected_content from " << c->noforwards << " to " << noforwards;
|
||||||
c->noforwards = noforwards;
|
c->noforwards = noforwards;
|
||||||
c->is_noforwards_changed = true;
|
c->is_noforwards_changed = true;
|
||||||
c->need_save_to_database = true;
|
c->need_save_to_database = true;
|
||||||
@ -13421,7 +13421,7 @@ void ContactsManager::on_update_channel_has_location(Channel *c, ChannelId chann
|
|||||||
|
|
||||||
void ContactsManager::on_update_channel_noforwards(Channel *c, ChannelId channel_id, bool noforwards) {
|
void ContactsManager::on_update_channel_noforwards(Channel *c, ChannelId channel_id, bool noforwards) {
|
||||||
if (c->noforwards != noforwards) {
|
if (c->noforwards != noforwards) {
|
||||||
LOG(INFO) << "Update " << channel_id << " noforwards from " << c->noforwards << " to " << noforwards;
|
LOG(INFO) << "Update " << channel_id << " has_protected_content from " << c->noforwards << " to " << noforwards;
|
||||||
c->noforwards = noforwards;
|
c->noforwards = noforwards;
|
||||||
c->is_noforwards_changed = true;
|
c->is_noforwards_changed = true;
|
||||||
c->need_save_to_database = true;
|
c->need_save_to_database = true;
|
||||||
|
@ -107,8 +107,8 @@ class ContactsManager final : public Actor {
|
|||||||
RestrictedRights get_channel_default_permissions(ChannelId channel_id) const;
|
RestrictedRights get_channel_default_permissions(ChannelId channel_id) const;
|
||||||
RestrictedRights get_secret_chat_default_permissions(SecretChatId secret_chat_id) const;
|
RestrictedRights get_secret_chat_default_permissions(SecretChatId secret_chat_id) const;
|
||||||
|
|
||||||
bool get_chat_allow_saving_content(ChatId chat_id) const;
|
bool get_chat_has_protected_content(ChatId chat_id) const;
|
||||||
bool get_channel_allow_saving_content(ChannelId channel_id) const;
|
bool get_channel_has_protected_content(ChannelId channel_id) const;
|
||||||
|
|
||||||
string get_user_private_forward_name(UserId user_id);
|
string get_user_private_forward_name(UserId user_id);
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
|
|||||||
}
|
}
|
||||||
case telegram_api::channelAdminLogEventActionToggleNoForwards::ID: {
|
case telegram_api::channelAdminLogEventActionToggleNoForwards::ID: {
|
||||||
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionToggleNoForwards>(action_ptr);
|
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionToggleNoForwards>(action_ptr);
|
||||||
return td_api::make_object<td_api::chatEventAllowSavingContentToggled>(!action->new_value_);
|
return td_api::make_object<td_api::chatEventHasProtectedContentToggled>(action->new_value_);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -1485,12 +1485,12 @@ class ToggleNoForwardsQuery final : public Td::ResultHandler {
|
|||||||
explicit ToggleNoForwardsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
explicit ToggleNoForwardsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void send(DialogId dialog_id, bool allow_saving_content) {
|
void send(DialogId dialog_id, bool has_protected_content) {
|
||||||
dialog_id_ = dialog_id;
|
dialog_id_ = dialog_id;
|
||||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
||||||
CHECK(input_peer != nullptr);
|
CHECK(input_peer != nullptr);
|
||||||
send_query(G()->net_query_creator().create(
|
send_query(G()->net_query_creator().create(
|
||||||
telegram_api::messages_toggleNoForwards(std::move(input_peer), !allow_saving_content)));
|
telegram_api::messages_toggleNoForwards(std::move(input_peer), has_protected_content)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_result(BufferSlice packet) final {
|
void on_result(BufferSlice packet) final {
|
||||||
@ -10184,7 +10184,7 @@ bool MessagesManager::can_save_message(DialogId dialog_id, const Message *m) con
|
|||||||
if (m == nullptr || m->noforwards || m->is_content_secret) {
|
if (m == nullptr || m->noforwards || m->is_content_secret) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return get_dialog_allow_saving_content(dialog_id);
|
return !get_dialog_has_protected_content(dialog_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessagesManager::can_get_message_statistics(FullMessageId full_message_id) {
|
bool MessagesManager::can_get_message_statistics(FullMessageId full_message_id) {
|
||||||
@ -20335,7 +20335,7 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
|||||||
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
||||||
get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
|
get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
|
||||||
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
|
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
|
||||||
get_chat_positions_object(d), get_default_sender_id_object(d), get_dialog_allow_saving_content(d->dialog_id),
|
get_chat_positions_object(d), get_default_sender_id_object(d), get_dialog_has_protected_content(d->dialog_id),
|
||||||
d->is_marked_as_unread, d->is_blocked, get_dialog_has_scheduled_messages(d), can_delete_for_self,
|
d->is_marked_as_unread, d->is_blocked, get_dialog_has_scheduled_messages(d), can_delete_for_self,
|
||||||
can_delete_for_all_users, can_report_dialog(d->dialog_id), d->notification_settings.silent_send_message,
|
can_delete_for_all_users, can_report_dialog(d->dialog_id), d->notification_settings.silent_send_message,
|
||||||
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
|
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
|
||||||
@ -26953,7 +26953,7 @@ Result<MessagesManager::ForwardedMessages> MessagesManager::get_forwarded_messag
|
|||||||
if (from_dialog_id.get_type() == DialogType::SecretChat) {
|
if (from_dialog_id.get_type() == DialogType::SecretChat) {
|
||||||
return Status::Error(400, "Can't forward messages from secret chats");
|
return Status::Error(400, "Can't forward messages from secret chats");
|
||||||
}
|
}
|
||||||
if (!get_dialog_allow_saving_content(from_dialog_id)) {
|
if (get_dialog_has_protected_content(from_dialog_id)) {
|
||||||
for (const auto ©_option : copy_options) {
|
for (const auto ©_option : copy_options) {
|
||||||
if (!copy_option.send_copy || !td_->auth_manager_->is_bot()) {
|
if (!copy_option.send_copy || !td_->auth_manager_->is_bot()) {
|
||||||
return Status::Error(400, "Administrators of the chat restricted message forwarding");
|
return Status::Error(400, "Administrators of the chat restricted message forwarding");
|
||||||
@ -31091,12 +31091,12 @@ void MessagesManager::on_dialog_default_permissions_updated(DialogId dialog_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::on_dialog_allow_saving_content_updated(DialogId dialog_id) {
|
void MessagesManager::on_dialog_has_protected_content_updated(DialogId dialog_id) {
|
||||||
auto d = get_dialog(dialog_id); // called from update_chat, must not create the dialog
|
auto d = get_dialog(dialog_id); // called from update_chat, must not create the dialog
|
||||||
if (d != nullptr && d->is_update_new_chat_sent) {
|
if (d != nullptr && d->is_update_new_chat_sent) {
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
td_api::make_object<td_api::updateChatAllowSavingContent>(dialog_id.get(),
|
td_api::make_object<td_api::updateChatHasProtectedContent>(
|
||||||
get_dialog_allow_saving_content(dialog_id)));
|
dialog_id.get(), get_dialog_has_protected_content(dialog_id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31550,20 +31550,20 @@ RestrictedRights MessagesManager::get_dialog_default_permissions(DialogId dialog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessagesManager::get_dialog_allow_saving_content(DialogId dialog_id) const {
|
bool MessagesManager::get_dialog_has_protected_content(DialogId dialog_id) const {
|
||||||
switch (dialog_id.get_type()) {
|
switch (dialog_id.get_type()) {
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
return true;
|
return false;
|
||||||
case DialogType::Chat:
|
case DialogType::Chat:
|
||||||
return td_->contacts_manager_->get_chat_allow_saving_content(dialog_id.get_chat_id());
|
return td_->contacts_manager_->get_chat_has_protected_content(dialog_id.get_chat_id());
|
||||||
case DialogType::Channel:
|
case DialogType::Channel:
|
||||||
return td_->contacts_manager_->get_channel_allow_saving_content(dialog_id.get_channel_id());
|
return td_->contacts_manager_->get_channel_has_protected_content(dialog_id.get_channel_id());
|
||||||
case DialogType::SecretChat:
|
case DialogType::SecretChat:
|
||||||
return true;
|
return false;
|
||||||
case DialogType::None:
|
case DialogType::None:
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32210,9 +32210,9 @@ void MessagesManager::set_dialog_permissions(DialogId dialog_id,
|
|||||||
td_->create_handler<EditChatDefaultBannedRightsQuery>(std::move(promise))->send(dialog_id, new_permissions);
|
td_->create_handler<EditChatDefaultBannedRightsQuery>(std::move(promise))->send(dialog_id, new_permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::toggle_dialog_allow_saving_content(DialogId dialog_id, bool allow_saving_content,
|
void MessagesManager::toggle_dialog_has_protected_content(DialogId dialog_id, bool has_protected_content,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
if (!have_dialog_force(dialog_id, "toggle_dialog_allow_saving_content")) {
|
if (!have_dialog_force(dialog_id, "toggle_dialog_has_protected_content")) {
|
||||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||||
}
|
}
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
@ -32243,13 +32243,13 @@ void MessagesManager::toggle_dialog_allow_saving_content(DialogId dialog_id, boo
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO this can be wrong if there were previous toggle_dialog_allow_saving_content requests
|
// TODO this can be wrong if there were previous toggle_dialog_has_protected_content requests
|
||||||
if (get_dialog_allow_saving_content(dialog_id) == allow_saving_content) {
|
if (get_dialog_has_protected_content(dialog_id) == has_protected_content) {
|
||||||
return promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO invoke after
|
// TODO invoke after
|
||||||
td_->create_handler<ToggleNoForwardsQuery>(std::move(promise))->send(dialog_id, allow_saving_content);
|
td_->create_handler<ToggleNoForwardsQuery>(std::move(promise))->send(dialog_id, has_protected_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::set_dialog_theme(DialogId dialog_id, const string &theme_name, Promise<Unit> &&promise) {
|
void MessagesManager::set_dialog_theme(DialogId dialog_id, const string &theme_name, Promise<Unit> &&promise) {
|
||||||
|
@ -506,7 +506,7 @@ class MessagesManager final : public Actor {
|
|||||||
void set_dialog_permissions(DialogId dialog_id, const td_api::object_ptr<td_api::chatPermissions> &permissions,
|
void set_dialog_permissions(DialogId dialog_id, const td_api::object_ptr<td_api::chatPermissions> &permissions,
|
||||||
Promise<Unit> &&promise);
|
Promise<Unit> &&promise);
|
||||||
|
|
||||||
void toggle_dialog_allow_saving_content(DialogId dialog_id, bool allow_saving_content, Promise<Unit> &&promise);
|
void toggle_dialog_has_protected_content(DialogId dialog_id, bool has_protected_content, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void set_dialog_theme(DialogId dialog_id, const string &theme_name, Promise<Unit> &&promise);
|
void set_dialog_theme(DialogId dialog_id, const string &theme_name, Promise<Unit> &&promise);
|
||||||
|
|
||||||
@ -802,7 +802,7 @@ class MessagesManager final : public Actor {
|
|||||||
void on_dialog_title_updated(DialogId dialog_id);
|
void on_dialog_title_updated(DialogId dialog_id);
|
||||||
void on_dialog_username_updated(DialogId dialog_id, const string &old_username, const string &new_username);
|
void on_dialog_username_updated(DialogId dialog_id, const string &old_username, const string &new_username);
|
||||||
void on_dialog_default_permissions_updated(DialogId dialog_id);
|
void on_dialog_default_permissions_updated(DialogId dialog_id);
|
||||||
void on_dialog_allow_saving_content_updated(DialogId dialog_id);
|
void on_dialog_has_protected_content_updated(DialogId dialog_id);
|
||||||
|
|
||||||
void on_dialog_user_is_contact_updated(DialogId dialog_id, bool is_contact);
|
void on_dialog_user_is_contact_updated(DialogId dialog_id, bool is_contact);
|
||||||
void on_dialog_user_is_deleted_updated(DialogId dialog_id, bool is_deleted);
|
void on_dialog_user_is_deleted_updated(DialogId dialog_id, bool is_deleted);
|
||||||
@ -2900,7 +2900,7 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
RestrictedRights get_dialog_default_permissions(DialogId dialog_id) const;
|
RestrictedRights get_dialog_default_permissions(DialogId dialog_id) const;
|
||||||
|
|
||||||
bool get_dialog_allow_saving_content(DialogId dialog_id) const;
|
bool get_dialog_has_protected_content(DialogId dialog_id) const;
|
||||||
|
|
||||||
bool get_dialog_has_scheduled_messages(const Dialog *d) const;
|
bool get_dialog_has_scheduled_messages(const Dialog *d) const;
|
||||||
|
|
||||||
|
@ -6157,10 +6157,10 @@ void Td::on_request(uint64 id, td_api::setChatDraftMessage &request) {
|
|||||||
std::move(request.draft_message_)));
|
std::move(request.draft_message_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::toggleChatAllowSavingContent &request) {
|
void Td::on_request(uint64 id, const td_api::toggleChatHasProtectedContent &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
messages_manager_->toggle_dialog_allow_saving_content(DialogId(request.chat_id_), request.allow_saving_content_,
|
messages_manager_->toggle_dialog_has_protected_content(DialogId(request.chat_id_), request.has_protected_content_,
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, td_api::setChatDraftMessage &request);
|
void on_request(uint64 id, td_api::setChatDraftMessage &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::toggleChatAllowSavingContent &request);
|
void on_request(uint64 id, const td_api::toggleChatHasProtectedContent &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::toggleChatIsPinned &request);
|
void on_request(uint64 id, const td_api::toggleChatIsPinned &request);
|
||||||
|
|
||||||
|
@ -3194,10 +3194,10 @@ class CliClient final : public Actor {
|
|||||||
send_request(td_api::make_object<td_api::clearAllDraftMessages>());
|
send_request(td_api::make_object<td_api::clearAllDraftMessages>());
|
||||||
} else if (op == "tcasc") {
|
} else if (op == "tcasc") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
bool allow_saving_content;
|
bool has_protected_content;
|
||||||
get_args(args, chat_id, allow_saving_content);
|
get_args(args, chat_id, has_protected_content);
|
||||||
send_request(
|
send_request(
|
||||||
td_api::make_object<td_api::toggleChatAllowSavingContent>(as_chat_id(chat_id), allow_saving_content));
|
td_api::make_object<td_api::toggleChatHasProtectedContent>(as_chat_id(chat_id), has_protected_content));
|
||||||
} else if (op == "tcip" || op == "tcipa" || begins_with(op, "tcip-")) {
|
} else if (op == "tcip" || op == "tcipa" || begins_with(op, "tcip-")) {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
bool is_pinned;
|
bool is_pinned;
|
||||||
|
Loading…
Reference in New Issue
Block a user