From 90b6403e86815b54cd027ec0eed991060d6b6cfd Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 28 Dec 2022 21:46:16 +0300 Subject: [PATCH] Improve message_auto_delete_time field and class names. --- td/generate/scheme/td_api.tl | 62 ++++++++++++++++----------------- td/telegram/DialogEventLog.cpp | 4 +-- td/telegram/MessageContent.cpp | 6 ++-- td/telegram/MessageTtl.cpp | 2 +- td/telegram/MessageTtl.h | 2 +- td/telegram/MessagesManager.cpp | 14 ++++---- td/telegram/MessagesManager.h | 2 +- td/telegram/Td.cpp | 20 +++++------ td/telegram/Td.h | 6 ++-- td/telegram/cli.cpp | 50 +++++++++++++------------- 10 files changed, 84 insertions(+), 84 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 9bbf0d2ee..d3975f8df 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1058,16 +1058,16 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n //@reply_in_chat_id If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id //@reply_to_message_id If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@self_destruct_timer The message's self-destruct timer, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires -//@self_destruct_in Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_timer field -//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_timer setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires +//@self_destruct_time The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires +//@self_destruct_in Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field +//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent //@author_signature For channel posts and anonymous group messages, optional author signature //@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 self_destruct_timer:int32 self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 self_destruct_time:int32 self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -1286,7 +1286,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@unread_reaction_count Number of messages with unread reactions in the chat //@notification_settings Notification settings for the chat //@available_reactions Types of reaction, available in the chat -//@message_auto_delete_timer Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0 if disabled. Self-destruct timer in secret chats is counted from the time message or its content is viewed. Auto-delete timer in other chats is counted from the send date +//@message_auto_delete_time Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0 if disabled. Self-destruct timer in secret chats starts after the message or its content is viewed. Auto-delete timer in other chats starts from the send date //@theme_name If non-empty, name of a theme, set for the chat //@action_bar Information about actions which must be possible to do through the chat action bar; may be null //@video_chat Information about video chat of the chat @@ -1294,7 +1294,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 //@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 -chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector 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 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_timer: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 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 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time: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 number of chats found @chat_ids List of chat identifiers chats total_count:int32 chat_ids:vector = Chats; @@ -2388,8 +2388,8 @@ messageScreenshotTaken = MessageContent; //@description A theme in the chat has been changed @theme_name If non-empty, name of a new theme, set for the chat. Otherwise chat theme was reset to the default one messageChatSetTheme theme_name:string = MessageContent; -//@description The auto-delete or self-destruct timer setting for messages in the chat has been changed @auto_delete_timer New value auto-delete or self-destruct timer, in seconds; 0 if disabled @from_user_id If not 0, a user identifier, which default setting was automatically applied -messageChatSetMessageAutoDeleteTimer auto_delete_timer:int32 from_user_id:int53 = MessageContent; +//@description The auto-delete or self-destruct timer for messages in the chat has been changed @message_auto_delete_time New value auto-delete or self-destruct time, in seconds; 0 if disabled @from_user_id If not 0, a user identifier, which default setting was automatically applied +messageChatSetMessageAutoDeleteTime message_auto_delete_time:int32 from_user_id:int53 = MessageContent; //@description A forum topic has been created @name Name of the topic @icon Icon of the topic messageForumTopicCreated name:string icon:forumTopicIcon = MessageContent; @@ -2608,9 +2608,9 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@width Photo width //@height Photo height //@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_timer Photo self-destruct timer, in seconds (0-60). A non-zero self-destruct timer can be specified only in private chats +//@self_destruct_time Photo self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats //@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats -inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_timer:int32 has_spoiler:Bool = InputMessageContent; +inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText self_destruct_time:int32 has_spoiler:Bool = InputMessageContent; //@description A sticker message //@sticker Sticker to be sent @@ -2629,9 +2629,9 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@height Video height //@supports_streaming True, if the video is supposed to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_timer Video self-destruct timer, in seconds (0-60). A non-zero self-destruct timer can be specified only in private chats +//@self_destruct_time Video self-destruct time, in seconds (0-60). A non-zero self-destruct time can be specified only in private chats //@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_timer:int32 has_spoiler:Bool = InputMessageContent; +inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_time:int32 has_spoiler:Bool = InputMessageContent; //@description A video note message //@video_note Video note to be sent @@ -3487,8 +3487,8 @@ chatEventLinkedChatChanged old_linked_chat_id:int53 new_linked_chat_id:int53 = C //@description The supergroup location was changed @old_location Previous location; may be null @new_location New location; may be null chatEventLocationChanged old_location:chatLocation new_location:chatLocation = ChatEventAction; -//@description The message auto-delete timer was changed @old_message_auto_delete_timer Previous value of message_auto_delete_timer @new_message_auto_delete_timer New value of message_auto_delete_timer -chatEventMessageAutoDeleteTimerChanged old_message_auto_delete_timer:int32 new_message_auto_delete_timer:int32 = ChatEventAction; +//@description The message auto-delete timer was changed @old_message_auto_delete_time Previous value of message_auto_delete_time @new_message_auto_delete_time New value of message_auto_delete_time +chatEventMessageAutoDeleteTimeChanged old_message_auto_delete_time:int32 new_message_auto_delete_time:int32 = ChatEventAction; //@description The chat permissions was changed @old_permissions Previous chat permissions @new_permissions New chat permissions chatEventPermissionsChanged old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; @@ -4239,8 +4239,8 @@ userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting; accountTtl days:int32 = AccountTtl; -//@description Contains default auto-delete timer setting for new chats @auto_delete_timer Message auto-delete timer setting, in seconds. If 0, then messages aren't deleted automatically -messageAutoDeleteTimer auto_delete_timer:int32 = MessageAutoDeleteTimer; +//@description Contains default auto-delete timer setting for new chats @time Message auto-delete time, in seconds. If 0, then messages aren't deleted automatically +messageAutoDeleteTime time:int32 = MessageAutoDeleteTime; //@class SessionType @description Represents the type of a session @@ -4438,7 +4438,7 @@ internalLinkTypeChangePhoneNumber = InternalLinkType; //@description The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link internalLinkTypeChatInvite invite_link:string = InternalLinkType; -//@description The link is a link to the default message auto-delete timer section of the app settings +//@description The link is a link to the default message auto-delete timer settings section of the app settings internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; //@description The link is a link to the edit profile section of the app settings @@ -5072,8 +5072,8 @@ updateChatDraftMessage chat_id:int53 draft_message:draftMessage positions:vector //@description The message sender that is selected to send messages in a chat has changed @chat_id Chat identifier @message_sender_id New value of message_sender_id; may be null if the user can't change message sender updateChatMessageSender chat_id:int53 message_sender_id:MessageSender = Update; -//@description The message auto-delete or self-destruct timer setting for a chat was changed @chat_id Chat identifier @message_auto_delete_timer New value of message_auto_delete_timer -updateChatMessageAutoDeleteTimer chat_id:int53 message_auto_delete_timer:int32 = Update; +//@description The message auto-delete or self-destruct timer setting for a chat was changed @chat_id Chat identifier @message_auto_delete_time New value of message_auto_delete_time +updateChatMessageAutoDeleteTime chat_id:int53 message_auto_delete_time:int32 = Update; //@description Notification settings for a chat were changed @chat_id Chat identifier @notification_settings The new notification settings updateChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Update; @@ -6411,17 +6411,17 @@ createSecretChat secret_chat_id:int32 = Chat; //@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat //@user_ids Identifiers of users to be added to the basic group //@title Title of the new basic group; 1-128 characters -//@message_auto_delete_timer Message auto-delete timer value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -createNewBasicGroupChat user_ids:vector title:string message_auto_delete_timer:int32 = Chat; +//@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically +createNewBasicGroupChat user_ids:vector title:string message_auto_delete_time:int32 = Chat; //@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat //@title Title of the new chat; 1-128 characters //@is_channel Pass true to create a channel chat //@param_description Chat description; 0-255 characters //@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat -//@message_auto_delete_timer Message auto-delete timer value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically +//@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically //@for_import Pass true to create a supergroup for importing messages using importMessage -createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation message_auto_delete_timer:int32 for_import:Bool = Chat; +createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation message_auto_delete_time:int32 for_import:Bool = Chat; //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user createNewSecretChat user_id:int53 = Chat; @@ -6470,11 +6470,11 @@ setChatTitle chat_id:int53 title:string = Ok; //@photo New chat photo; pass null to delete the chat photo setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; -//@description Changes the message auto-delete or self-destruct (for secret chats) timer in a chat. Requires change_info administrator right in basic groups, supergroups and channels -//-Message auto-delete timer can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). +//@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels +//-Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). //@chat_id Chat identifier -//@message_auto_delete_timer New timer value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -setChatMessageAutoDeleteTimer chat_id:int53 message_auto_delete_timer:int32 = Ok; +//@message_auto_delete_time New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically +setChatMessageAutoDeleteTime chat_id:int53 message_auto_delete_time:int32 = Ok; //@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right //@chat_id Chat identifier @@ -7527,11 +7527,11 @@ getAccountTtl = AccountTtl; deleteAccount reason:string password:string = Ok; -//@description Changes the default message auto-delete timer for new chats @message_auto_delete_timer New message auto-delete timer; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -setDefaultMessageAutoDeleteTimer message_auto_delete_timer:messageAutoDeleteTimer = Ok; +//@description Changes the default message auto-delete time for new chats @message_auto_delete_time New default message auto-delete time; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically +setDefaultMessageAutoDeleteTime message_auto_delete_time:messageAutoDeleteTime = Ok; -//@description Returns default message auto-delete timer setting for new chats -getDefaultMessageAutoDeleteTimer = MessageAutoDeleteTimer; +//@description Returns default message auto-delete time setting for new chats +getDefaultMessageAutoDeleteTime = MessageAutoDeleteTime; //@description Removes a chat action bar without any other action @chat_id Chat identifier diff --git a/td/telegram/DialogEventLog.cpp b/td/telegram/DialogEventLog.cpp index cfd4ed4e8..b1288b6f0 100644 --- a/td/telegram/DialogEventLog.cpp +++ b/td/telegram/DialogEventLog.cpp @@ -343,8 +343,8 @@ static td_api::object_ptr get_chat_event_action_object( auto action = move_tl_object_as(action_ptr); auto old_value = MessageTtl(clamp(action->prev_value_, 0, 86400 * 366)); auto new_value = MessageTtl(clamp(action->new_value_, 0, 86400 * 366)); - return td_api::make_object( - old_value.get_message_auto_delete_timer_object(), new_value.get_message_auto_delete_timer_object()); + return td_api::make_object( + old_value.get_message_auto_delete_time_object(), new_value.get_message_auto_delete_time_object()); } case telegram_api::channelAdminLogEventActionToggleNoForwards::ID: { auto action = move_tl_object_as(action_ptr); diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index e77d19a18..b4733f241 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -1967,7 +1967,7 @@ static Result create_input_message_content( if (input_photo->height_ < 0 || input_photo->height_ > 10000) { return Status::Error(400, "Wrong photo height"); } - ttl = input_photo->self_destruct_timer_; + ttl = input_photo->self_destruct_time_; auto message_photo = make_unique(); @@ -2029,7 +2029,7 @@ static Result create_input_message_content( case td_api::inputMessageVideo::ID: { auto input_video = static_cast(input_message_content.get()); - ttl = input_video->self_destruct_timer_; + ttl = input_video->self_destruct_time_; bool has_stickers = !sticker_file_ids.empty(); td->videos_manager_->create_video( @@ -5504,7 +5504,7 @@ tl_object_ptr get_message_content_object(const MessageCo return make_tl_object(); case MessageContentType::ChatSetTtl: { const auto *m = static_cast(content); - return make_tl_object( + return make_tl_object( m->ttl, td->contacts_manager_->get_user_id_object(m->from_user_id, "MessageChatSetTtl")); } case MessageContentType::Call: { diff --git a/td/telegram/MessageTtl.cpp b/td/telegram/MessageTtl.cpp index 58d48e64f..fd7bd157d 100644 --- a/td/telegram/MessageTtl.cpp +++ b/td/telegram/MessageTtl.cpp @@ -12,7 +12,7 @@ bool MessageTtl::is_empty() const { return period_ == 0; } -int32 MessageTtl::get_message_auto_delete_timer_object() const { +int32 MessageTtl::get_message_auto_delete_time_object() const { return period_; } diff --git a/td/telegram/MessageTtl.h b/td/telegram/MessageTtl.h index 98122c43e..f5db5944b 100644 --- a/td/telegram/MessageTtl.h +++ b/td/telegram/MessageTtl.h @@ -32,7 +32,7 @@ class MessageTtl { bool is_empty() const; - int32 get_message_auto_delete_timer_object() const; + int32 get_message_auto_delete_time_object() const; int32 get_input_ttl_period() const; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 11917adb1..1ba6d2725 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -21905,7 +21905,7 @@ td_api::object_ptr MessagesManager::get_chat_object(const Dialog * d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(), d->last_read_outbox_message_id.get(), d->unread_mention_count, d->unread_reaction_count, get_chat_notification_settings_object(&d->notification_settings), std::move(available_reactions), - d->message_ttl.get_message_auto_delete_timer_object(), get_dialog_theme_name(d), get_chat_action_bar_object(d), + d->message_ttl.get_message_auto_delete_time_object(), get_dialog_theme_name(d), get_chat_action_bar_object(d), get_video_chat_object(d), get_chat_join_requests_info_object(d), d->reply_markup_message_id.get(), std::move(draft_message), d->client_data); } @@ -31829,13 +31829,13 @@ void MessagesManager::send_update_chat_message_sender(const Dialog *d) { td_api::make_object(d->dialog_id.get(), get_default_message_sender_object(d))); } -void MessagesManager::send_update_chat_message_auto_delete_timer(const Dialog *d) { +void MessagesManager::send_update_chat_message_auto_delete_time(const Dialog *d) { CHECK(d != nullptr); - LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_message_auto_delete_timer"; - on_dialog_updated(d->dialog_id, "send_update_chat_message_auto_delete_timer"); + LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_message_auto_delete_time"; + on_dialog_updated(d->dialog_id, "send_update_chat_message_auto_delete_time"); send_closure(G()->td(), &Td::send_update, - td_api::make_object( - d->dialog_id.get(), d->message_ttl.get_message_auto_delete_timer_object())); + td_api::make_object( + d->dialog_id.get(), d->message_ttl.get_message_auto_delete_time_object())); } void MessagesManager::send_update_chat_has_scheduled_messages(Dialog *d, bool from_deletion) { @@ -33336,7 +33336,7 @@ void MessagesManager::set_dialog_message_ttl(Dialog *d, MessageTtl message_ttl) if (d->message_ttl != message_ttl) { d->message_ttl = message_ttl; d->is_message_ttl_inited = true; - send_update_chat_message_auto_delete_timer(d); + send_update_chat_message_auto_delete_time(d); } if (!d->is_message_ttl_inited) { d->is_message_ttl_inited = true; diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 38c18e30b..05e555b69 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -2564,7 +2564,7 @@ class MessagesManager final : public Actor { void send_update_chat_message_sender(const Dialog *d); - void send_update_chat_message_auto_delete_timer(const Dialog *d); + void send_update_chat_message_auto_delete_time(const Dialog *d); void send_update_chat_has_scheduled_messages(Dialog *d, bool from_deletion); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 4bfc1b3e0..4e69b52da 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4454,26 +4454,26 @@ void Td::on_request(uint64 id, td_api::setUserPrivacySettingRules &request) { std::move(promise)); } -void Td::on_request(uint64 id, const td_api::getDefaultMessageAutoDeleteTimer &request) { +void Td::on_request(uint64 id, const td_api::getDefaultMessageAutoDeleteTime &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); auto query_promise = PromiseCreator::lambda([promise = std::move(promise)](Result result) mutable { if (result.is_error()) { promise.set_error(result.move_as_error()); } else { - promise.set_value(td_api::make_object(result.ok())); + promise.set_value(td_api::make_object(result.ok())); } }); get_default_message_ttl(this, std::move(query_promise)); } -void Td::on_request(uint64 id, const td_api::setDefaultMessageAutoDeleteTimer &request) { +void Td::on_request(uint64 id, const td_api::setDefaultMessageAutoDeleteTime &request) { CHECK_IS_USER(); - if (request.message_auto_delete_timer_ == nullptr) { - return send_error_raw(id, 400, "New default message TTL must be non-empty"); + if (request.message_auto_delete_time_ == nullptr) { + return send_error_raw(id, 400, "New default message auto-delete time must be non-empty"); } CREATE_OK_REQUEST_PROMISE(); - set_default_message_ttl(this, request.message_auto_delete_timer_->auto_delete_timer_, std::move(promise)); + set_default_message_ttl(this, request.message_auto_delete_time_->time_, std::move(promise)); } void Td::on_request(uint64 id, const td_api::getAccountTtl &request) { @@ -5699,7 +5699,7 @@ void Td::on_request(uint64 id, td_api::createNewBasicGroupChat &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.title_); CREATE_REQUEST(CreateNewGroupChatRequest, UserId::get_user_ids(request.user_ids_), std::move(request.title_), - request.message_auto_delete_timer_); + request.message_auto_delete_time_); } void Td::on_request(uint64 id, td_api::createNewSupergroupChat &request) { @@ -5708,7 +5708,7 @@ void Td::on_request(uint64 id, td_api::createNewSupergroupChat &request) { CLEAN_INPUT_STRING(request.description_); CREATE_REQUEST(CreateNewSupergroupChatRequest, std::move(request.title_), !request.is_channel_, std::move(request.description_), std::move(request.location_), request.for_import_, - request.message_auto_delete_timer_); + request.message_auto_delete_time_); } void Td::on_request(uint64 id, td_api::createNewSecretChat &request) { @@ -6126,9 +6126,9 @@ void Td::on_request(uint64 id, const td_api::setChatPhoto &request) { messages_manager_->set_dialog_photo(DialogId(request.chat_id_), request.photo_, std::move(promise)); } -void Td::on_request(uint64 id, const td_api::setChatMessageAutoDeleteTimer &request) { +void Td::on_request(uint64 id, const td_api::setChatMessageAutoDeleteTime &request) { CREATE_OK_REQUEST_PROMISE(); - messages_manager_->set_dialog_message_ttl(DialogId(request.chat_id_), request.message_auto_delete_timer_, + messages_manager_->set_dialog_message_ttl(DialogId(request.chat_id_), request.message_auto_delete_time_, std::move(promise)); } diff --git a/td/telegram/Td.h b/td/telegram/Td.h index f49c6117a..06ff74414 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -470,9 +470,9 @@ class Td final : public Actor { void on_request(uint64 id, td_api::setUserPrivacySettingRules &request); - void on_request(uint64 id, const td_api::getDefaultMessageAutoDeleteTimer &request); + void on_request(uint64 id, const td_api::getDefaultMessageAutoDeleteTime &request); - void on_request(uint64 id, const td_api::setDefaultMessageAutoDeleteTimer &request); + void on_request(uint64 id, const td_api::setDefaultMessageAutoDeleteTime &request); void on_request(uint64 id, const td_api::getAccountTtl &request); @@ -892,7 +892,7 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::setChatPhoto &request); - void on_request(uint64 id, const td_api::setChatMessageAutoDeleteTimer &request); + void on_request(uint64 id, const td_api::setChatMessageAutoDeleteTime &request); void on_request(uint64 id, const td_api::setChatPermissions &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index ea036b345..539db7879 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2522,12 +2522,12 @@ class CliClient final : public Actor { } else if (op == "me") { send_request(td_api::make_object()); } else if (op == "sdmadt") { - int32 auto_delete_timer; - get_args(args, auto_delete_timer); - send_request(td_api::make_object( - td_api::make_object(auto_delete_timer))); + int32 auto_delete_time; + get_args(args, auto_delete_time); + send_request(td_api::make_object( + td_api::make_object(auto_delete_time))); } else if (op == "gdmadt") { - send_request(td_api::make_object()); + send_request(td_api::make_object()); } else if (op == "sattl") { int32 days; get_args(args, days); @@ -3696,7 +3696,7 @@ class CliClient final : public Actor { if (op[3] == 'p') { send_message(chat_id, td_api::make_object( as_local_file("rgb.jpg"), nullptr, Auto(), 0, 0, as_caption(message), - message_self_destruct_timer_, has_spoiler_)); + message_self_destruct_time_, has_spoiler_)); } else { send_message(chat_id, td_api::make_object(as_formatted_text(message), false, true)); } @@ -3716,7 +3716,7 @@ class CliClient final : public Actor { } else if (op == "shs") { has_spoiler_ = as_bool(args); } else if (op == "smsdt") { - message_self_destruct_timer_ = to_integer(args); + message_self_destruct_time_ = to_integer(args); } else if (op == "gcams") { ChatId chat_id; get_args(args, chat_id); @@ -3773,7 +3773,7 @@ class CliClient final : public Actor { } auto input_message_contents = transform(full_split(args), [this](const string &photo) { td_api::object_ptr content = td_api::make_object( - as_input_file(photo), nullptr, Auto(), 0, 0, as_caption(""), rand_bool() ? message_self_destruct_timer_ : 0, + as_input_file(photo), nullptr, Auto(), 0, 0, as_caption(""), rand_bool() ? message_self_destruct_time_ : 0, has_spoiler_ && rand_bool()); return content; }); @@ -3853,7 +3853,7 @@ class CliClient final : public Actor { send_request(td_api::make_object( chat_id, message_id, nullptr, td_api::make_object(as_input_file(photo), as_input_thumbnail(photo), Auto(), 0, 0, - as_caption(""), message_self_destruct_timer_, has_spoiler_))); + as_caption(""), message_self_destruct_time_, has_spoiler_))); } else if (op == "emvt") { ChatId chat_id; MessageId message_id; @@ -3863,7 +3863,7 @@ class CliClient final : public Actor { send_request(td_api::make_object( chat_id, message_id, nullptr, td_api::make_object(as_input_file(video), as_input_thumbnail(thumbnail), Auto(), 1, - 2, 3, true, as_caption(""), message_self_destruct_timer_, + 2, 3, true, as_caption(""), message_self_destruct_time_, has_spoiler_))); } else if (op == "emll") { ChatId chat_id; @@ -4180,7 +4180,7 @@ class CliClient final : public Actor { get_args(args, chat_id, photo, caption, sticker_file_ids); send_message(chat_id, td_api::make_object( as_input_file(photo), nullptr, to_integers(sticker_file_ids), 0, 0, - as_caption(caption), message_self_destruct_timer_, has_spoiler_)); + as_caption(caption), message_self_destruct_time_, has_spoiler_)); } else if (op == "spg") { ChatId chat_id; string photo_path; @@ -4189,7 +4189,7 @@ class CliClient final : public Actor { get_args(args, chat_id, photo_path, conversion, expected_size); send_message(chat_id, td_api::make_object( as_generated_file(photo_path, conversion, expected_size), nullptr, vector(), 0, - 0, as_caption(""), message_self_destruct_timer_, has_spoiler_)); + 0, as_caption(""), message_self_destruct_time_, has_spoiler_)); } else if (op == "spt") { ChatId chat_id; string photo_path; @@ -4197,7 +4197,7 @@ class CliClient final : public Actor { get_args(args, chat_id, photo_path, thumbnail_path); send_message(chat_id, td_api::make_object( as_input_file(photo_path), as_input_thumbnail(thumbnail_path, 90, 89), vector(), - 0, 0, as_caption(""), message_self_destruct_timer_, has_spoiler_)); + 0, 0, as_caption(""), message_self_destruct_time_, has_spoiler_)); } else if (op == "sptg") { ChatId chat_id; string photo_path; @@ -4207,7 +4207,7 @@ class CliClient final : public Actor { send_message(chat_id, td_api::make_object( as_input_file(photo_path), as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89), - vector(), 0, 0, as_caption(""), message_self_destruct_timer_, has_spoiler_)); + vector(), 0, 0, as_caption(""), message_self_destruct_time_, has_spoiler_)); } else if (op == "spgtg") { ChatId chat_id; string photo_path; @@ -4218,14 +4218,14 @@ class CliClient final : public Actor { send_message(chat_id, td_api::make_object( as_generated_file(photo_path, conversion), as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89), vector(), 0, 0, - as_caption(""), message_self_destruct_timer_, has_spoiler_)); + as_caption(""), message_self_destruct_time_, has_spoiler_)); } else if (op == "spid") { ChatId chat_id; string file_id; get_args(args, chat_id, file_id); send_message(chat_id, td_api::make_object(as_input_file_id(file_id), nullptr, vector(), 0, 0, as_caption(""), - message_self_destruct_timer_, has_spoiler_)); + message_self_destruct_time_, has_spoiler_)); } else if (op == "ss") { ChatId chat_id; string sticker_path; @@ -4259,7 +4259,7 @@ class CliClient final : public Actor { } send_message(chat_id, td_api::make_object( as_input_file(video_path), nullptr, std::move(sticker_file_ids), 1, 2, 3, true, - as_caption(""), message_self_destruct_timer_, has_spoiler_)); + as_caption(""), message_self_destruct_time_, has_spoiler_)); } else if (op == "svt") { ChatId chat_id; string video; @@ -4267,7 +4267,7 @@ class CliClient final : public Actor { get_args(args, chat_id, video, thumbnail); send_message(chat_id, td_api::make_object( as_input_file(video), as_input_thumbnail(thumbnail), vector(), 0, 0, 0, true, - as_caption(""), message_self_destruct_timer_, has_spoiler_)); + as_caption(""), message_self_destruct_time_, has_spoiler_)); } else if (op == "svn") { ChatId chat_id; string video_path; @@ -4317,10 +4317,10 @@ class CliClient final : public Actor { } else if (op == "cnbgc") { string user_ids_string; string title; - int32 message_auto_delete_timer; - get_args(args, user_ids_string, title, message_auto_delete_timer); + int32 message_auto_delete_time; + get_args(args, user_ids_string, title, message_auto_delete_time); send_request(td_api::make_object(as_user_ids(user_ids_string), title, - message_auto_delete_timer)); + message_auto_delete_time)); } else if (op == "cnchc" || op == "cnchcadt") { send_request(td_api::make_object(args, true, "Description", nullptr, op == "cnchcadt" ? 86400 : 0, false)); @@ -4436,9 +4436,9 @@ class CliClient final : public Actor { to_double(main_frame_timestamp)))); } else if (op == "scmt") { ChatId chat_id; - int32 auto_delete_timer; - get_args(args, chat_id, auto_delete_timer); - send_request(td_api::make_object(chat_id, auto_delete_timer)); + int32 auto_delete_time; + get_args(args, chat_id, auto_delete_time); + send_request(td_api::make_object(chat_id, auto_delete_time)); } else if (op == "scperm") { ChatId chat_id; string permissions; @@ -5344,7 +5344,7 @@ class CliClient final : public Actor { string schedule_date_; MessageThreadId message_thread_id_; bool has_spoiler_ = false; - int32 message_self_destruct_timer_ = 0; + int32 message_self_destruct_time_ = 0; int64 opened_chat_id_ = 0; ConcurrentScheduler *scheduler_{nullptr};