Add td_api::messageChatBoost.
This commit is contained in:
parent
cb3c623fd2
commit
64635aefe1
@ -2906,6 +2906,9 @@ messageChatSetTheme theme_name:string = 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 The chat was boosted by the sender of the message @boost_count Number of times the chat was boosted
|
||||
messageChatBoost boost_count:int32 = MessageContent;
|
||||
|
||||
//@description A forum topic has been created @name Name of the topic @icon Icon of the topic
|
||||
messageForumTopicCreated name:string icon:forumTopicIcon = MessageContent;
|
||||
|
||||
|
@ -420,6 +420,7 @@ bool DialogAction::is_canceled_by_message_of_type(MessageContentType message_con
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::BoostApply:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -498,7 +498,7 @@ class MessageChatSetTtl final : public MessageContent {
|
||||
|
||||
class MessageUnsupported final : public MessageContent {
|
||||
public:
|
||||
static constexpr int32 CURRENT_VERSION = 28;
|
||||
static constexpr int32 CURRENT_VERSION = 29;
|
||||
int32 version = CURRENT_VERSION;
|
||||
|
||||
MessageUnsupported() = default;
|
||||
@ -1088,6 +1088,19 @@ class MessageExpiredVoiceNote final : public MessageContent {
|
||||
}
|
||||
};
|
||||
|
||||
class MessageBoostApply final : public MessageContent {
|
||||
public:
|
||||
int32 boost_count = 0;
|
||||
|
||||
MessageBoostApply() = default;
|
||||
explicit MessageBoostApply(int32 boost_count) : boost_count(boost_count) {
|
||||
}
|
||||
|
||||
MessageContentType get_type() const final {
|
||||
return MessageContentType::BoostApply;
|
||||
}
|
||||
};
|
||||
|
||||
template <class StorerT>
|
||||
static void store(const MessageContent *content, StorerT &storer) {
|
||||
CHECK(content != nullptr);
|
||||
@ -1637,6 +1650,13 @@ static void store(const MessageContent *content, StorerT &storer) {
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
case MessageContentType::BoostApply: {
|
||||
const auto *m = static_cast<const MessageBoostApply *>(content);
|
||||
BEGIN_STORE_FLAGS();
|
||||
END_STORE_FLAGS();
|
||||
store(m->boost_count, storer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -2362,6 +2382,17 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
content = make_unique<MessageExpiredVoiceNote>();
|
||||
break;
|
||||
case MessageContentType::BoostApply: {
|
||||
auto m = make_unique<MessageBoostApply>();
|
||||
BEGIN_PARSE_FLAGS();
|
||||
END_PARSE_FLAGS();
|
||||
parse(m->boost_count, parser);
|
||||
if (m->boost_count < 0) {
|
||||
is_bad = true;
|
||||
}
|
||||
content = std::move(m);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
is_bad = true;
|
||||
@ -3007,6 +3038,7 @@ bool can_have_input_media(const Td *td, const MessageContent *content, bool is_s
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return false;
|
||||
case MessageContentType::Animation:
|
||||
case MessageContentType::Audio:
|
||||
@ -3147,6 +3179,7 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td,
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3289,6 +3322,7 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3493,6 +3527,7 @@ void delete_message_content_thumbnail(MessageContent *content, Td *td) {
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3717,6 +3752,7 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return Status::OK();
|
||||
@ -3863,6 +3899,7 @@ static int32 get_message_content_media_index_mask(const MessageContent *content,
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return 0;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -4144,6 +4181,8 @@ vector<UserId> get_message_content_min_user_ids(const Td *td, const MessageConte
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
case MessageContentType::BoostApply:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -4548,6 +4587,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -4697,6 +4737,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
LOG(ERROR) << "Receive new file " << new_file_id << " in a sent message of the type " << content_type;
|
||||
break;
|
||||
default:
|
||||
@ -5223,6 +5264,14 @@ void compare_message_contents(Td *td, const MessageContent *old_content, const M
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
case MessageContentType::BoostApply: {
|
||||
const auto *lhs = static_cast<const MessageBoostApply *>(old_content);
|
||||
const auto *rhs = static_cast<const MessageBoostApply *>(new_content);
|
||||
if (lhs->boost_count != rhs->boost_count) {
|
||||
need_update = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -6384,6 +6433,7 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return nullptr;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -7193,6 +7243,10 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
return make_tl_object<td_api::messageExpiredVideoNote>();
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return make_tl_object<td_api::messageExpiredVoiceNote>();
|
||||
case MessageContentType::BoostApply: {
|
||||
const auto *m = static_cast<const MessageBoostApply *>(content);
|
||||
return td_api::make_object<td_api::messageChatBoost>(m->boost_count);
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
@ -7627,6 +7681,7 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return string();
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -7969,6 +8024,8 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
case MessageContentType::BoostApply:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
@ -142,6 +142,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType cont
|
||||
return string_builder << "ExpiredVideoNote";
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return string_builder << "ExpiredVoiceNote";
|
||||
case MessageContentType::BoostApply:
|
||||
return string_builder << "BoostApply";
|
||||
default:
|
||||
return string_builder << "Invalid type " << static_cast<int32>(content_type);
|
||||
}
|
||||
@ -215,6 +217,7 @@ bool is_allowed_media_group_content(MessageContentType content_type) {
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -294,6 +297,7 @@ bool can_be_secret_message_content(MessageContentType content_type) {
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -369,6 +373,7 @@ bool is_service_message_content(MessageContentType content_type) {
|
||||
case MessageContentType::GiftCode:
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::BoostApply:
|
||||
return true;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -492,6 +497,7 @@ bool can_have_message_content_caption(MessageContentType content_type) {
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -78,7 +78,8 @@ enum class MessageContentType : int32 {
|
||||
GiveawayResults,
|
||||
GiveawayWinners,
|
||||
ExpiredVideoNote,
|
||||
ExpiredVoiceNote
|
||||
ExpiredVoiceNote,
|
||||
BoostApply
|
||||
};
|
||||
// increase MessageUnsupported::CURRENT_VERSION each time a new message content type is added
|
||||
|
||||
|
@ -24884,6 +24884,7 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::BoostApply:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
Loading…
Reference in New Issue
Block a user