Add messageForumTopicIsHiddenToggled.

This commit is contained in:
levlam 2022-11-30 15:39:29 +03:00
parent 8a0429c30f
commit 20ba802e48
5 changed files with 28 additions and 11 deletions

View File

@ -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<int32> = 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<groupCallVideoSourceGroup> 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

View File

@ -9,6 +9,9 @@
namespace td {
td_api::object_ptr<td_api::MessageContent> ForumTopicEditedData::get_message_content_object() const {
if (edit_is_hidden_ && !(!is_hidden_ && edit_is_closed_ && !is_closed_)) {
return td_api::make_object<td_api::messageForumTopicIsHiddenToggled>(is_hidden_);
}
if (edit_is_closed_) {
return td_api::make_object<td_api::messageForumTopicIsClosedToggled>(is_closed_);
}
@ -19,7 +22,8 @@ td_api::object_ptr<td_api::MessageContent> 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;
}

View File

@ -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 {

View File

@ -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);

View File

@ -5204,9 +5204,10 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
auto action = move_tl_object_as<telegram_api::messageActionTopicEdit>(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<MessageTopicEdit>(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<MessageTopicEdit>(
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();