From 20ba802e487c3d7bb0132fee9d838d52e077b196 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 30 Nov 2022 15:39:29 +0300 Subject: [PATCH] Add messageForumTopicIsHiddenToggled. --- td/generate/scheme/td_api.tl | 11 +++++++---- td/telegram/ForumTopicEditedData.cpp | 9 ++++++++- td/telegram/ForumTopicEditedData.h | 10 +++++++--- td/telegram/ForumTopicEditedData.hpp | 2 ++ td/telegram/MessageContent.cpp | 7 ++++--- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 959b92e60..60b6b8c62 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1327,7 +1327,7 @@ forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_ //@info Basic information about the topic //@last_message Last message in the topic; may be null //@is_pinned True, if the topic is pinned in the topic list -//@is_hidden True, if the topic is hidden above the topic list; for General topic only +//@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only //@unread_count Number of unread messages in the topic //@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message @@ -2105,9 +2105,12 @@ messageForumTopicCreated name:string icon:forumTopicIcon = MessageContent; //@description A forum topic has been edited @name If non-empty, the new name of the topic @edit_icon_custom_emoji_id True, if icon's custom_emoji_id is changed @icon_custom_emoji_id New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be ignored if edit_icon_custom_emoji_id is false messageForumTopicEdited name:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 = MessageContent; -//@description A forum topic has been closed or opened @is_closed True if the topic was closed or reopened +//@description A forum topic has been closed or opened @is_closed True, if the topic was closed, otherwise the topic was reopened messageForumTopicIsClosedToggled is_closed:Bool = MessageContent; +//@description A General forum topic has been hidden or unhidden @is_hidden True, if the topic was hidden, otherwise the topic was unhidden +messageForumTopicIsHiddenToggled is_hidden:Bool = MessageContent; + //@description A non-standard action has happened in the chat @text Message text to be shown in the chat messageCustomServiceAction text:string = MessageContent; @@ -2596,7 +2599,7 @@ groupCall id:int32 title:string scheduled_start_date:int32 enabled_start_notific groupCallVideoSourceGroup semantics:string source_ids:vector = GroupCallVideoSourceGroup; //@description Contains information about a group call participant's video channel @source_groups List of synchronization source groups of the video @endpoint_id Video channel endpoint identifier -//@is_paused True if the video is paused. This flag needs to be ignored, if new video frames are received +//@is_paused True, if the video is paused. This flag needs to be ignored, if new video frames are received groupCallParticipantVideoInfo source_groups:vector endpoint_id:string is_paused:Bool = GroupCallParticipantVideoInfo; //@description Represents a group call participant @@ -6067,7 +6070,7 @@ joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:i //@payload Group call join payload; received from tgcalls startGroupCallScreenSharing group_call_id:int32 audio_source_id:int32 payload:string = Text; -//@description Pauses or unpauses screen sharing in a joined group call @group_call_id Group call identifier @is_paused True if screen sharing is paused +//@description Pauses or unpauses screen sharing in a joined group call @group_call_id Group call identifier @is_paused True, if screen sharing is paused toggleGroupCallScreenSharingIsPaused group_call_id:int32 is_paused:Bool = Ok; //@description Ends screen sharing in a joined group call @group_call_id Group call identifier diff --git a/td/telegram/ForumTopicEditedData.cpp b/td/telegram/ForumTopicEditedData.cpp index 947ed3ae7..9bdd08c63 100644 --- a/td/telegram/ForumTopicEditedData.cpp +++ b/td/telegram/ForumTopicEditedData.cpp @@ -9,6 +9,9 @@ namespace td { td_api::object_ptr ForumTopicEditedData::get_message_content_object() const { + if (edit_is_hidden_ && !(!is_hidden_ && edit_is_closed_ && !is_closed_)) { + return td_api::make_object(is_hidden_); + } if (edit_is_closed_) { return td_api::make_object(is_closed_); } @@ -19,7 +22,8 @@ td_api::object_ptr ForumTopicEditedData::get_message_con bool operator==(const ForumTopicEditedData &lhs, const ForumTopicEditedData &rhs) { return lhs.title_ == rhs.title_ && lhs.icon_custom_emoji_id_ == rhs.icon_custom_emoji_id_ && lhs.edit_icon_custom_emoji_id_ == rhs.edit_icon_custom_emoji_id_ && - lhs.edit_is_closed_ == rhs.edit_is_closed_ && lhs.is_closed_ == rhs.is_closed_; + lhs.edit_is_closed_ == rhs.edit_is_closed_ && lhs.is_closed_ == rhs.is_closed_ && + lhs.edit_is_hidden_ == rhs.edit_is_hidden_ && lhs.is_hidden_ == rhs.is_hidden_; } bool operator!=(const ForumTopicEditedData &lhs, const ForumTopicEditedData &rhs) { @@ -36,6 +40,9 @@ StringBuilder &operator<<(StringBuilder &string_builder, const ForumTopicEditedD if (topic_edited_data.edit_is_closed_) { string_builder << "set is_closed to " << topic_edited_data.is_closed_; } + if (topic_edited_data.edit_is_hidden_) { + string_builder << "set is_hidden to " << topic_edited_data.is_hidden_; + } return string_builder; } diff --git a/td/telegram/ForumTopicEditedData.h b/td/telegram/ForumTopicEditedData.h index 681835e86..69f232f36 100644 --- a/td/telegram/ForumTopicEditedData.h +++ b/td/telegram/ForumTopicEditedData.h @@ -20,6 +20,8 @@ class ForumTopicEditedData { bool edit_icon_custom_emoji_id_ = false; bool edit_is_closed_ = false; bool is_closed_ = false; + bool edit_is_hidden_ = false; + bool is_hidden_ = false; friend bool operator==(const ForumTopicEditedData &lhs, const ForumTopicEditedData &rhs); @@ -31,16 +33,18 @@ class ForumTopicEditedData { ForumTopicEditedData() = default; ForumTopicEditedData(string &&title, bool edit_icon_custom_emoji_id, int64 icon_custom_emoji_id, bool edit_is_closed, - bool is_closed) + bool is_closed, bool edit_is_hidden, bool is_hidden) : title_(std::move(title)) , icon_custom_emoji_id_(icon_custom_emoji_id) , edit_icon_custom_emoji_id_(edit_icon_custom_emoji_id) , edit_is_closed_(edit_is_closed) - , is_closed_(is_closed) { + , is_closed_(is_closed) + , edit_is_hidden_(edit_is_hidden) + , is_hidden_(is_hidden) { } bool is_empty() const { - return title_.empty() && !edit_icon_custom_emoji_id_ && !edit_is_closed_; + return title_.empty() && !edit_icon_custom_emoji_id_ && !edit_is_closed_ && !edit_is_hidden_; } const string &get_title() const { diff --git a/td/telegram/ForumTopicEditedData.hpp b/td/telegram/ForumTopicEditedData.hpp index 6385da0a2..1809b0fcb 100644 --- a/td/telegram/ForumTopicEditedData.hpp +++ b/td/telegram/ForumTopicEditedData.hpp @@ -23,6 +23,7 @@ void ForumTopicEditedData::store(StorerT &storer) const { STORE_FLAG(is_closed_); STORE_FLAG(has_title); STORE_FLAG(has_icon_custom_emoji_id); + STORE_FLAG(is_hidden_); END_STORE_FLAGS(); if (has_title) { td::store(title_, storer); @@ -42,6 +43,7 @@ void ForumTopicEditedData::parse(ParserT &parser) { PARSE_FLAG(is_closed_); PARSE_FLAG(has_title); PARSE_FLAG(has_icon_custom_emoji_id); + PARSE_FLAG(is_hidden_); END_PARSE_FLAGS(); if (has_title) { td::parse(title_, parser); diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 883420edf..02e6d5e1d 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -5204,9 +5204,10 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptr(action_ptr); auto edit_icon_custom_emoji_id = (action->flags_ & telegram_api::messageActionTopicEdit::ICON_EMOJI_ID_MASK) != 0; auto edit_is_closed = (action->flags_ & telegram_api::messageActionTopicEdit::CLOSED_MASK) != 0; - return td::make_unique(ForumTopicEditedData{std::move(action->title_), - edit_icon_custom_emoji_id, action->icon_emoji_id_, - edit_is_closed, action->closed_}); + auto edit_is_hidden = (action->flags_ & telegram_api::messageActionTopicEdit::HIDDEN_MASK) != 0; + return td::make_unique( + ForumTopicEditedData{std::move(action->title_), edit_icon_custom_emoji_id, action->icon_emoji_id_, + edit_is_closed, action->closed_, edit_is_hidden, action->hidden_}); } default: UNREACHABLE();