Add class ForumTopicEditedData.

This commit is contained in:
levlam 2022-10-18 21:44:52 +03:00
parent d68836f482
commit 56e49bf53d
4 changed files with 88 additions and 0 deletions

View File

@ -352,6 +352,7 @@ set(TDLIB_SOURCE
td/telegram/files/FileUploader.cpp
td/telegram/files/PartsManager.cpp
td/telegram/files/ResourceManager.cpp
td/telegram/ForumTopicEditedData.cpp
td/telegram/ForumTopicIcon.cpp
td/telegram/ForumTopicInfo.cpp
td/telegram/Game.cpp
@ -581,6 +582,7 @@ set(TDLIB_SOURCE
td/telegram/files/ResourceManager.h
td/telegram/files/ResourceState.h
td/telegram/FolderId.h
td/telegram/ForumTopicEditedData.h
td/telegram/ForumTopicIcon.h
td/telegram/ForumTopicInfo.h
td/telegram/FullMessageId.h

View File

@ -1298,6 +1298,14 @@ webAppInfo launch_id:int64 url:string = WebAppInfo;
messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector<message> draft_message:draftMessage = MessageThreadInfo;
//@description Describes changed data about a forum topic
//@title If non-empty, the new title 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. Ignored if edit_icon_custom_emoji_id is false
//@edit_is_closed True, if the topic is reopened or closed
//@is_closed True, if the topic is closed, or false if it is reopened. Ignored if edit_is_closed is false
forumTopicEditedData title:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 edit_is_closed:Bool is_closed:Bool = ForumTopicEditedData;
//@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none
forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon;

View File

@ -0,0 +1,31 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/ForumTopicEditedData.h"
#include "td/utils/logging.h"
namespace td {
td_api::object_ptr<td_api::forumTopicEditedData> ForumTopicEditedData::get_forum_topic_edited_data_object() const {
return td_api::make_object<td_api::forumTopicEditedData>(title_, edit_icon_custom_emoji_id_,
icon_custom_emoji_id_.get(), edit_is_closed_, is_closed_);
}
StringBuilder &operator<<(StringBuilder &string_builder, const ForumTopicEditedData &topic_edited_data) {
if (!topic_edited_data.title_.empty()) {
string_builder << "set title to \"" << topic_edited_data.title_ << '"';
}
if (topic_edited_data.edit_icon_custom_emoji_id_) {
string_builder << "set icon to " << topic_edited_data.icon_custom_emoji_id_;
}
if (topic_edited_data.edit_is_closed_) {
string_builder << "set is_closed to " << topic_edited_data.is_closed_;
}
return string_builder;
}
} // namespace td

View File

@ -0,0 +1,47 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/CustomEmojiId.h"
#include "td/telegram/td_api.h"
#include "td/utils/common.h"
#include "td/utils/StringBuilder.h"
namespace td {
class ForumTopicEditedData {
string title_;
CustomEmojiId icon_custom_emoji_id_;
bool edit_icon_custom_emoji_id_ = false;
bool edit_is_closed_ = false;
bool is_closed_ = false;
friend StringBuilder &operator<<(StringBuilder &string_builder, const ForumTopicEditedData &topic_edited_data);
public:
ForumTopicEditedData() = default;
bool is_empty() const {
return title_.empty() && !edit_icon_custom_emoji_id_ && !edit_is_closed_;
}
ForumTopicEditedData(string &&title, bool edit_icon_custom_emoji_id, int64 icon_custom_emoji_id, bool edit_is_closed,
bool is_closed)
: 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) {
}
td_api::object_ptr<td_api::forumTopicEditedData> get_forum_topic_edited_data_object() const;
};
StringBuilder &operator<<(StringBuilder &string_builder, const ForumTopicEditedData &topic_edited_data);
} // namespace td