Add Message.replied_story_sender_user_id/replied_story_id.
This commit is contained in:
parent
e7ca635db9
commit
56314c5c79
@ -1158,6 +1158,8 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
|
||||
//@unread_reactions Information about unread reactions added to the message
|
||||
//@reply_in_chat_id If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id
|
||||
//@reply_to_message_id If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message
|
||||
//@replied_story_sender_user_id If non-zero, the identifier of the sender of the story this message is replying to
|
||||
//@replied_story_id If non-zero, the identifier of the story this message is replying to; can be the identifier of a deleted or an unaccessible message
|
||||
//@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs
|
||||
//@self_destruct_time The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires
|
||||
//@self_destruct_in Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field
|
||||
@ -1168,7 +1170,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
|
||||
//@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
|
||||
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_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_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 interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 self_destruct_time:int32 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_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_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 interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_in_chat_id:int53 reply_to_message_id:int53 replied_story_sender_user_id:int53 replied_story_id:int32 message_thread_id:int53 self_destruct_time:int32 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;
|
||||
|
||||
//@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;
|
||||
|
@ -16,9 +16,22 @@ namespace td {
|
||||
|
||||
MessageReplyHeader::MessageReplyHeader(tl_object_ptr<telegram_api::MessageReplyHeader> &&reply_header_ptr,
|
||||
DialogId dialog_id, MessageId message_id, int32 date, bool can_have_thread) {
|
||||
if (reply_header_ptr == nullptr || reply_header_ptr->get_id() != telegram_api::messageReplyHeader::ID) {
|
||||
if (reply_header_ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (reply_header_ptr->get_id() == telegram_api::messageReplyStoryHeader::ID) {
|
||||
auto reply_header = telegram_api::move_object_as<telegram_api::messageReplyStoryHeader>(reply_header_ptr);
|
||||
UserId user_id(reply_header->user_id_);
|
||||
StoryId story_id(reply_header->story_id_);
|
||||
if (!user_id.is_valid() || !story_id.is_server()) {
|
||||
LOG(ERROR) << "Receive " << to_string(reply_header);
|
||||
} else {
|
||||
story_sender_user_id_ = user_id;
|
||||
story_id_ = story_id;
|
||||
}
|
||||
return;
|
||||
}
|
||||
CHECK(reply_header_ptr->get_id() == telegram_api::messageReplyHeader::ID);
|
||||
auto reply_header = telegram_api::move_object_as<telegram_api::messageReplyHeader>(reply_header_ptr);
|
||||
if (reply_header->reply_to_scheduled_) {
|
||||
reply_to_message_id_ = MessageId(ScheduledServerMessageId(reply_header->reply_to_msg_id_), date);
|
||||
|
@ -8,7 +8,9 @@
|
||||
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/StoryId.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
|
||||
@ -20,6 +22,11 @@ struct MessageReplyHeader {
|
||||
MessageId top_thread_message_id_;
|
||||
bool is_topic_message_ = false;
|
||||
|
||||
// or
|
||||
|
||||
UserId story_sender_user_id_;
|
||||
StoryId story_id_;
|
||||
|
||||
MessageReplyHeader() = default;
|
||||
|
||||
MessageReplyHeader(tl_object_ptr<telegram_api::MessageReplyHeader> &&reply_header_ptr, DialogId dialog_id,
|
||||
|
@ -4685,6 +4685,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
bool has_reactions = reactions != nullptr;
|
||||
bool has_available_reactions_generation = available_reactions_generation != 0;
|
||||
bool has_history_generation = history_generation != 0;
|
||||
bool is_reply_to_story = reply_to_story_sender_user_id != UserId();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_channel_post);
|
||||
STORE_FLAG(is_outgoing);
|
||||
@ -4760,6 +4761,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
STORE_FLAG(update_stickersets_order);
|
||||
STORE_FLAG(is_topic_message);
|
||||
STORE_FLAG(has_history_generation);
|
||||
STORE_FLAG(is_reply_to_story);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
@ -4887,6 +4889,10 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
if (has_history_generation) {
|
||||
store(history_generation, storer);
|
||||
}
|
||||
if (is_reply_to_story) {
|
||||
store(reply_to_story_sender_user_id, storer);
|
||||
store(reply_to_story_id, storer);
|
||||
}
|
||||
}
|
||||
|
||||
// do not forget to resolve message dependencies
|
||||
@ -4935,6 +4941,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
bool has_reactions = false;
|
||||
bool has_available_reactions_generation = false;
|
||||
bool has_history_generation = false;
|
||||
bool is_reply_to_story = false;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_channel_post);
|
||||
PARSE_FLAG(is_outgoing);
|
||||
@ -5010,6 +5017,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
PARSE_FLAG(update_stickersets_order);
|
||||
PARSE_FLAG(is_topic_message);
|
||||
PARSE_FLAG(has_history_generation);
|
||||
PARSE_FLAG(is_reply_to_story);
|
||||
END_PARSE_FLAGS();
|
||||
}
|
||||
|
||||
@ -5147,6 +5155,10 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
if (has_history_generation) {
|
||||
parse(history_generation, parser);
|
||||
}
|
||||
if (is_reply_to_story) {
|
||||
parse(reply_to_story_sender_user_id, parser);
|
||||
parse(reply_to_story_id, parser);
|
||||
}
|
||||
|
||||
CHECK(content != nullptr);
|
||||
is_content_secret |=
|
||||
@ -14388,6 +14400,8 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
||||
message_info.reply_header.reply_to_message_id_);
|
||||
message_info.reply_header.reply_in_dialog_id_ = DialogId();
|
||||
message_info.reply_header.reply_to_message_id_ = MessageId();
|
||||
message_info.reply_header.story_sender_user_id_ = UserId();
|
||||
message_info.reply_header.story_id_ = StoryId();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -14507,6 +14521,17 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
||||
fix_server_reply_to_message_id(dialog_id, message_id, reply_in_dialog_id, reply_to_message_id);
|
||||
fix_server_reply_to_message_id(dialog_id, message_id, reply_in_dialog_id, top_thread_message_id);
|
||||
|
||||
UserId reply_to_story_sender_user_id = message_info.reply_header.story_sender_user_id_;
|
||||
StoryId reply_to_story_id = message_info.reply_header.story_id_;
|
||||
if (reply_to_story_sender_user_id != UserId() &&
|
||||
(dialog_type != DialogType::User ||
|
||||
(reply_to_story_sender_user_id != my_id && reply_to_story_sender_user_id != dialog_id.get_user_id()))) {
|
||||
LOG(ERROR) << "Receive reply to " << reply_to_story_id << " by " << reply_to_story_sender_user_id << " in "
|
||||
<< dialog_id;
|
||||
reply_to_story_sender_user_id = UserId();
|
||||
reply_to_story_id = StoryId();
|
||||
}
|
||||
|
||||
UserId via_bot_user_id = message_info.via_bot_user_id;
|
||||
if (!via_bot_user_id.is_valid()) {
|
||||
via_bot_user_id = UserId();
|
||||
@ -14612,7 +14637,8 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
||||
message->reply_in_dialog_id = reply_in_dialog_id;
|
||||
message->top_thread_message_id = top_thread_message_id;
|
||||
message->is_topic_message = is_topic_message;
|
||||
message->via_bot_user_id = via_bot_user_id;
|
||||
message->reply_to_story_sender_user_id = reply_to_story_sender_user_id;
|
||||
message->reply_to_story_id = reply_to_story_id;
|
||||
message->restriction_reasons = std::move(message_info.restriction_reasons);
|
||||
message->author_signature = std::move(message_info.author_signature);
|
||||
message->is_outgoing = is_outgoing;
|
||||
@ -24078,7 +24104,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
|
||||
m->message_id.get(), std::move(sender), get_chat_id_object(dialog_id, "get_dialog_event_log_message_object"),
|
||||
nullptr, nullptr, m->is_outgoing, m->is_pinned, false, false, can_be_saved, 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(interaction_info), Auto(), 0, 0, 0, 0, 0.0, 0.0, via_bot_user_id,
|
||||
std::move(forward_info), std::move(interaction_info), Auto(), 0, 0, 0, 0, 0, 0, 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));
|
||||
}
|
||||
@ -24180,9 +24206,11 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
|
||||
can_get_message_thread, can_get_viewers, can_get_media_timestamp_links, can_report_reactions,
|
||||
has_timestamped_media, m->is_channel_post, m->is_topic_message, m->contains_unread_mention, date, edit_date,
|
||||
std::move(forward_info), std::move(interaction_info), std::move(unread_reactions),
|
||||
get_chat_id_object(reply_in_dialog_id, "get_message_object reply"), reply_to_message_id, top_thread_message_id,
|
||||
m->ttl, 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));
|
||||
get_chat_id_object(reply_in_dialog_id, "get_message_object reply"), reply_to_message_id,
|
||||
td_->contacts_manager_->get_user_id_object(m->reply_to_story_sender_user_id, "reply_to_story_sender_user_id"),
|
||||
m->reply_to_story_id.get(), top_thread_message_id, m->ttl, 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));
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::messages> MessagesManager::get_messages_object(int32 total_count, DialogId dialog_id,
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "td/telegram/SecretChatId.h"
|
||||
#include "td/telegram/SecretInputMedia.h"
|
||||
#include "td/telegram/ServerMessageId.h"
|
||||
#include "td/telegram/StoryId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
@ -1184,6 +1185,8 @@ class MessagesManager final : public Actor {
|
||||
int64 reply_to_random_id = 0; // for send_message
|
||||
DialogId reply_in_dialog_id;
|
||||
MessageId top_thread_message_id;
|
||||
UserId reply_to_story_sender_user_id;
|
||||
StoryId reply_to_story_id;
|
||||
MessageId linked_top_thread_message_id;
|
||||
vector<MessageId> local_thread_message_ids;
|
||||
|
||||
|
@ -229,8 +229,6 @@ class PollManager final : public Actor {
|
||||
MultiTimeout close_poll_timeout_{"ClosePollTimeout"};
|
||||
MultiTimeout unload_poll_timeout_{"UnloadPollTimeout"};
|
||||
|
||||
Td *td_;
|
||||
ActorShared<> parent_;
|
||||
WaitFreeHashMap<PollId, unique_ptr<Poll>, PollIdHash> polls_;
|
||||
|
||||
WaitFreeHashMap<PollId, WaitFreeHashSet<FullMessageId, FullMessageIdHash>, PollIdHash> server_poll_messages_;
|
||||
@ -254,6 +252,9 @@ class PollManager final : public Actor {
|
||||
FlatHashSet<PollId, PollIdHash> loaded_from_database_polls_;
|
||||
|
||||
FlatHashSet<PollId, PollIdHash> being_closed_polls_;
|
||||
|
||||
Td *td_;
|
||||
ActorShared<> parent_;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
Loading…
Reference in New Issue
Block a user