Add Message.sender_boost_count.
This commit is contained in:
parent
539fd729ea
commit
e62f612c36
@ -1364,12 +1364,13 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag
|
||||
//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet
|
||||
//@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
|
||||
//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent
|
||||
//@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead
|
||||
//@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 if none
|
||||
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_replied_in_another_chat: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_read_date: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 import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType 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_replied_in_another_chat: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_read_date: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 import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_boost_count:int32 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<message> = Messages;
|
||||
|
@ -16736,6 +16736,17 @@ bool ContactsManager::get_channel_effective_has_hidden_participants(ChannelId ch
|
||||
return channel_full->has_hidden_participants || !channel_full->can_get_participants;
|
||||
}
|
||||
|
||||
int32 ContactsManager::get_channel_my_boost_count(ChannelId channel_id) {
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, true, "get_channel_my_boost_count");
|
||||
if (channel_full == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return channel_full->boost_count;
|
||||
}
|
||||
|
||||
bool ContactsManager::have_channel(ChannelId channel_id) const {
|
||||
return channels_.count(channel_id) > 0;
|
||||
}
|
||||
|
@ -653,6 +653,7 @@ class ContactsManager final : public Actor {
|
||||
ChannelId get_channel_linked_channel_id(ChannelId channel_id, const char *source);
|
||||
int32 get_channel_slow_mode_delay(ChannelId channel_id, const char *source);
|
||||
bool get_channel_effective_has_hidden_participants(ChannelId channel_id, const char *source);
|
||||
int32 get_channel_my_boost_count(ChannelId channel_id);
|
||||
|
||||
void add_chat_participant(ChatId chat_id, UserId user_id, int32 forward_limit, Promise<Unit> &&promise);
|
||||
|
||||
|
@ -4016,6 +4016,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
bool has_forward_info = forward_info != nullptr;
|
||||
bool has_saved_messages_topic_id = saved_messages_topic_id.is_valid();
|
||||
bool has_initial_top_thread_message_id = !message_id.is_any_server() && initial_top_thread_message_id.is_valid();
|
||||
bool has_sender_boost_count = sender_boost_count != 0;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_channel_post);
|
||||
STORE_FLAG(is_outgoing);
|
||||
@ -4099,6 +4100,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_forward_info);
|
||||
STORE_FLAG(has_saved_messages_topic_id);
|
||||
STORE_FLAG(has_initial_top_thread_message_id);
|
||||
STORE_FLAG(has_sender_boost_count);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
@ -4219,6 +4221,9 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
if (has_initial_top_thread_message_id) {
|
||||
store(initial_top_thread_message_id, storer);
|
||||
}
|
||||
if (has_sender_boost_count) {
|
||||
store(sender_boost_count, storer);
|
||||
}
|
||||
}
|
||||
|
||||
// do not forget to resolve message dependencies
|
||||
@ -4274,6 +4279,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
bool has_forward_info = false;
|
||||
bool has_saved_messages_topic_id = false;
|
||||
bool has_initial_top_thread_message_id = false;
|
||||
bool has_sender_boost_count = false;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_channel_post);
|
||||
PARSE_FLAG(is_outgoing);
|
||||
@ -4357,6 +4363,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
PARSE_FLAG(has_forward_info);
|
||||
PARSE_FLAG(has_saved_messages_topic_id);
|
||||
PARSE_FLAG(has_initial_top_thread_message_id);
|
||||
PARSE_FLAG(has_sender_boost_count);
|
||||
END_PARSE_FLAGS();
|
||||
}
|
||||
|
||||
@ -4541,6 +4548,9 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
if (has_initial_top_thread_message_id) {
|
||||
parse(initial_top_thread_message_id, parser);
|
||||
}
|
||||
if (has_sender_boost_count) {
|
||||
parse(sender_boost_count, parser);
|
||||
}
|
||||
|
||||
CHECK(content != nullptr);
|
||||
is_content_secret |= ttl.is_secret_message_content(content->get_type()); // repair is_content_secret for old messages
|
||||
@ -12986,6 +12996,7 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
||||
message_info.reply_markup = std::move(message->reply_markup_);
|
||||
message_info.restriction_reasons = get_restriction_reasons(std::move(message->restriction_reason_));
|
||||
message_info.author_signature = std::move(message->post_author_);
|
||||
message_info.sender_boost_count = message->from_boosts_applied_;
|
||||
if (message->saved_peer_id_ != nullptr) {
|
||||
message_info.saved_messages_topic_id = SavedMessagesTopicId(DialogId(message->saved_peer_id_));
|
||||
}
|
||||
@ -13271,6 +13282,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
||||
message->reply_to_story_full_id = reply_to_story_full_id;
|
||||
message->restriction_reasons = std::move(message_info.restriction_reasons);
|
||||
message->author_signature = std::move(message_info.author_signature);
|
||||
message->sender_boost_count = message_info.sender_boost_count;
|
||||
message->saved_messages_topic_id = message_info.saved_messages_topic_id;
|
||||
message->is_outgoing = is_outgoing;
|
||||
message->is_channel_post = is_channel_post;
|
||||
@ -22548,8 +22560,8 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
|
||||
nullptr, nullptr, m->is_outgoing, m->is_pinned, false, false, false, can_be_saved, false, false, false, false,
|
||||
false, false, false, false, false, true, m->is_channel_post, m->is_topic_message, false, m->date, edit_date,
|
||||
std::move(forward_info), std::move(import_info), std::move(interaction_info), Auto(), nullptr, 0, 0, nullptr, 0.0,
|
||||
0.0, via_bot_user_id, m->author_signature, 0, get_restriction_reason_description(m->restriction_reasons),
|
||||
std::move(content), std::move(reply_markup));
|
||||
0.0, via_bot_user_id, m->sender_boost_count, m->author_signature, 0,
|
||||
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::message> MessagesManager::get_message_object(MessageFullId message_full_id, const char *source) {
|
||||
@ -22660,9 +22672,9 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
|
||||
m->is_topic_message, m->contains_unread_mention, date, edit_date, std::move(forward_info), std::move(import_info),
|
||||
std::move(interaction_info), std::move(unread_reactions), std::move(reply_to), top_thread_message_id,
|
||||
td_->saved_messages_manager_->get_saved_messages_topic_id_object(m->saved_messages_topic_id),
|
||||
std::move(self_destruct_type), ttl_expires_in, auto_delete_in, via_bot_user_id, m->author_signature,
|
||||
m->media_album_id, get_restriction_reason_description(m->restriction_reasons), std::move(content),
|
||||
std::move(reply_markup));
|
||||
std::move(self_destruct_type), ttl_expires_in, auto_delete_in, via_bot_user_id, m->sender_boost_count,
|
||||
m->author_signature, m->media_album_id, get_restriction_reason_description(m->restriction_reasons),
|
||||
std::move(content), std::move(reply_markup));
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::messages> MessagesManager::get_messages_object(int32 total_count, DialogId dialog_id,
|
||||
@ -22855,6 +22867,9 @@ unique_ptr<MessagesManager::Message> MessagesManager::create_message_to_send(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m->sender_user_id == my_id && dialog_type == DialogType::Channel) {
|
||||
m->sender_boost_count = td_->contacts_manager_->get_channel_my_boost_count(dialog_id.get_channel_id());
|
||||
}
|
||||
m->content = std::move(content);
|
||||
m->invert_media = invert_media;
|
||||
m->forward_info = std::move(forward_info);
|
||||
@ -26953,6 +26968,9 @@ Result<MessageId> MessagesManager::add_local_message(
|
||||
m->update_stickersets_order = false;
|
||||
m->view_count = 0;
|
||||
m->forward_count = 0;
|
||||
if (m->sender_user_id == my_id && dialog_type == DialogType::Channel) {
|
||||
m->sender_boost_count = td_->contacts_manager_->get_channel_my_boost_count(dialog_id.get_channel_id());
|
||||
}
|
||||
m->content = std::move(message_content.content);
|
||||
m->invert_media = message_content.invert_media;
|
||||
m->disable_web_page_preview = message_content.disable_web_page_preview;
|
||||
@ -33403,6 +33421,11 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
|
||||
old_message->sender_dialog_id = new_message->sender_dialog_id;
|
||||
need_send_update = true;
|
||||
}
|
||||
if (old_message->sender_boost_count != new_message->sender_boost_count) {
|
||||
LOG(DEBUG) << "Change sender boost count";
|
||||
old_message->sender_boost_count = new_message->sender_boost_count;
|
||||
need_send_update = true;
|
||||
}
|
||||
if (old_message->forward_info != new_message->forward_info) {
|
||||
if (!replace_legacy && is_new_available &&
|
||||
MessageForwardInfo::need_change_warning(old_message->forward_info.get(), new_message->forward_info.get(),
|
||||
|
@ -981,6 +981,7 @@ class MessagesManager final : public Actor {
|
||||
int32 forward_count = 0;
|
||||
tl_object_ptr<telegram_api::messageReplies> reply_info;
|
||||
tl_object_ptr<telegram_api::messageReactions> reactions;
|
||||
int32 sender_boost_count = 0;
|
||||
int32 edit_date = 0;
|
||||
vector<RestrictionReason> restriction_reasons;
|
||||
string author_signature;
|
||||
@ -1010,7 +1011,8 @@ class MessagesManager final : public Actor {
|
||||
int32 date = 0;
|
||||
int32 edit_date = 0;
|
||||
int32 send_date = 0;
|
||||
int32 sending_id = 0;
|
||||
int32 sending_id = 0; // for yet unsent messages
|
||||
int32 sender_boost_count = 0;
|
||||
|
||||
int64 random_id = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user