Update layer 119.

GitOrigin-RevId: fba8e1e0e8cf9b6fda11ab3762bd6efca5865eb8
This commit is contained in:
levlam 2020-09-18 18:32:59 +03:00
parent 8405b08f0a
commit b45ccc6d14
12 changed files with 141 additions and 67 deletions

View File

@ -645,8 +645,9 @@ messageForwardInfo origin:MessageForwardOrigin date:int32 public_service_announc
//@forward_count Number of times the message was forwarded
//@reply_count Number of times the message was directly or indirectly replied; discussion supergroups and discussed channels only
//@recent_replier_user_ids User identifiers of the recent repliers to the channel post
//@last_read_comment_message_id Identifier of the last read comment to the channel post in the corresponding discussion supergroup
messageInteractionInfo view_count:int32 forward_count:int32 reply_count:int32 recent_replier_user_ids:vector<int32> last_read_comment_message_id:int53 = MessageInteractionInfo;
//@last_read_inbox_comment_message_id Identifier of the last read incoming comment to the channel post in the corresponding discussion supergroup
//@last_read_outbox_comment_message_id Identifier of the last read outgoing comment to the channel post in the corresponding discussion supergroup
messageInteractionInfo view_count:int32 forward_count:int32 reply_count:int32 recent_replier_user_ids:vector<int32> last_read_inbox_comment_message_id:int53 last_read_outbox_comment_message_id:int53 = MessageInteractionInfo;
//@class MessageSendingState @description Contains information about the sending state of the message

Binary file not shown.

View File

@ -219,8 +219,6 @@ contact#f911c994 user_id:int mutual:Bool = Contact;
importedContact#d0028438 user_id:int client_id:long = ImportedContact;
contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;
contacts.contactsNotModified#b74ba9d2 = contacts.Contacts;
@ -228,8 +226,8 @@ contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector
contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;
contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
contacts.blocked#ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;
contacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;
messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
@ -280,7 +278,6 @@ updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;
updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update;
updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update;
updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;
updateUserBlocked#80ece81a user_id:int blocked:Bool = Update;
updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
@ -347,7 +344,10 @@ updateDialogFilters#3504914f = Update;
updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update;
updateChannelParticipant#65d2b464 flags:# channel_id:int date:int user_id:int prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant qts:int = Update;
updateChannelMessageForwards#6e8a84df channel_id:int id:int forwards:int = Update;
updateReadDiscussion#119fb587 peer:Peer msg_id:int read_max_id:int = Update;
updateReadChannelDiscussionInbox#c661c143 channel_id:int top_msg_id:int read_max_id:int = Update;
updateReadChannelDiscussionOutbox#4638a26c channel_id:int top_msg_id:int read_max_id:int = Update;
updatePeerBlocked#246a4b22 peer_id:Peer blocked:Bool = Update;
updateChannelUserTyping#ff2abe9f flags:# channel_id:int top_msg_id:flags.0?int user_id:int action:SendMessageAction = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -1153,12 +1153,14 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats;
messages.discussionMessage#6d64690e flags:# messages:Vector<Message> max_id:flags.0?int read_max_id:flags.1?int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
messages.discussionMessage#f5dd8f9d flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
messageReplies#4128faac flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?int max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -1266,8 +1268,8 @@ contacts.getContacts#c023849f hash:int = contacts.Contacts;
contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;
contacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates;
contacts.deleteByPhones#1013fd9e phones:Vector<string> = Bool;
contacts.block#332b49fc id:InputUser = Bool;
contacts.unblock#e54100bd id:InputUser = Bool;
contacts.block#68cc1411 id:InputPeer = Bool;
contacts.unblock#bea65d50 id:InputPeer = Bool;
contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;
contacts.search#11f812d8 q:string limit:int = contacts.Found;
contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
@ -1288,7 +1290,7 @@ messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessag
messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;

Binary file not shown.

View File

@ -359,10 +359,11 @@ class SetUserIsBlockedQuery : public Td::ResultHandler {
void send(UserId user_id, tl_object_ptr<telegram_api::InputUser> &&input_user, bool is_blocked) {
user_id_ = user_id;
auto input_peer = td->contacts_manager_->get_input_peer_user(user_id, AccessRights::Read);
if (is_blocked) {
send_query(G()->net_query_creator().create(telegram_api::contacts_block(std::move(input_user))));
send_query(G()->net_query_creator().create(telegram_api::contacts_block(std::move(input_peer))));
} else {
send_query(G()->net_query_creator().create(telegram_api::contacts_unblock(std::move(input_user))));
send_query(G()->net_query_creator().create(telegram_api::contacts_unblock(std::move(input_peer))));
}
}
@ -4723,16 +4724,20 @@ int64 ContactsManager::get_blocked_users(int32 offset, int32 limit, Promise<Unit
}
void ContactsManager::on_get_blocked_users_result(int32 offset, int32 limit, int64 random_id, int32 total_count,
vector<tl_object_ptr<telegram_api::contactBlocked>> &&blocked_users) {
LOG(INFO) << "Receive " << blocked_users.size() << " blocked users out of " << total_count;
vector<tl_object_ptr<telegram_api::peerBlocked>> &&blocked_peers) {
LOG(INFO) << "Receive " << blocked_peers.size() << " blocked users out of " << total_count;
auto it = found_blocked_users_.find(random_id);
CHECK(it != found_blocked_users_.end());
auto &result = it->second.second;
CHECK(result.empty());
for (auto &blocked_user : blocked_users) {
CHECK(blocked_user != nullptr);
UserId user_id(blocked_user->user_id_);
for (auto &blocked_peer : blocked_peers) {
CHECK(blocked_peer != nullptr);
DialogId dialog_id(blocked_peer->peer_id_);
if (dialog_id.get_type() != DialogType::User) {
continue;
}
auto user_id = dialog_id.get_user_id();
if (have_user(user_id)) {
result.push_back(user_id);
} else {

View File

@ -296,7 +296,7 @@ class ContactsManager : public Actor {
int64 get_blocked_users(int32 offset, int32 limit, Promise<Unit> &&promise);
void on_get_blocked_users_result(int32 offset, int32 limit, int64 random_id, int32 total_count,
vector<tl_object_ptr<telegram_api::contactBlocked>> &&blocked_users);
vector<tl_object_ptr<telegram_api::peerBlocked>> &&blocked_peers);
void on_failed_get_blocked_users(int64 random_id);

View File

@ -41,11 +41,13 @@ MessageReplyInfo::MessageReplyInfo(tl_object_ptr<telegram_api::messageReplies> &
LOG(ERROR) << "Receive " << dialog_id << " as a recent replier";
}
}
if ((reply_info->flags_ & telegram_api::messageReplies::MAX_ID_MASK) != 0 && reply_info->max_id_ > 0) {
if ((reply_info->flags_ & telegram_api::messageReplies::MAX_ID_MASK) != 0 &&
ServerMessageId(reply_info->max_id_).is_valid()) {
max_message_id = MessageId(ServerMessageId(reply_info->max_id_));
}
if ((reply_info->flags_ & telegram_api::messageReplies::READ_MAX_ID_MASK) != 0 && reply_info->read_max_id_ > 0) {
max_read_message_id = MessageId(ServerMessageId(reply_info->read_max_id_));
if ((reply_info->flags_ & telegram_api::messageReplies::READ_MAX_ID_MASK) != 0 &&
ServerMessageId(reply_info->read_max_id_).is_valid()) {
last_read_inbox_message_id = MessageId(ServerMessageId(reply_info->read_max_id_));
}
}
}
@ -62,10 +64,13 @@ bool MessageReplyInfo::update_max_message_ids(const MessageReplyInfo &other) {
return false;
}
return update_max_message_ids(other.max_message_id, other.max_read_message_id);
return update_max_message_ids(other.max_message_id, other.last_read_inbox_message_id,
other.last_read_outbox_message_id);
}
bool MessageReplyInfo::update_max_message_ids(MessageId other_max_message_id, MessageId other_max_read_message_id) {
bool MessageReplyInfo::update_max_message_ids(MessageId other_max_message_id,
MessageId other_last_read_inbox_message_id,
MessageId other_last_read_outbox_message_id) {
if (!is_comment) {
return false;
}
@ -75,8 +80,12 @@ bool MessageReplyInfo::update_max_message_ids(MessageId other_max_message_id, Me
max_message_id = other_max_message_id;
result = true;
}
if (other_max_read_message_id > max_read_message_id) {
max_read_message_id = other_max_read_message_id;
if (other_last_read_inbox_message_id > last_read_inbox_message_id) {
last_read_inbox_message_id = other_last_read_inbox_message_id;
result = true;
}
if (other_last_read_outbox_message_id > last_read_outbox_message_id) {
last_read_outbox_message_id = other_last_read_outbox_message_id;
result = true;
}
return result;
@ -103,7 +112,8 @@ void MessageReplyInfo::add_reply(DialogId replier_dialog_id, MessageId reply_mes
StringBuilder &operator<<(StringBuilder &string_builder, const MessageReplyInfo &reply_info) {
if (reply_info.is_comment) {
return string_builder << reply_info.reply_count << " comments in " << reply_info.channel_id << " by "
<< reply_info.recent_replier_dialog_ids << " read up to " << reply_info.max_read_message_id;
<< reply_info.recent_replier_dialog_ids << " read up to "
<< reply_info.last_read_inbox_message_id << "/" << reply_info.last_read_outbox_message_id;
} else {
return string_builder << reply_info.reply_count << " replies";
}

View File

@ -23,7 +23,8 @@ struct MessageReplyInfo {
vector<DialogId> recent_replier_dialog_ids; // comments only
ChannelId channel_id; // comments only
MessageId max_message_id; // comments only
MessageId max_read_message_id; // comments only
MessageId last_read_inbox_message_id; // comments only
MessageId last_read_outbox_message_id; // comments only
bool is_comment = false;
MessageReplyInfo() = default;
@ -36,7 +37,8 @@ struct MessageReplyInfo {
bool need_update_to(const MessageReplyInfo &other) const;
bool update_max_message_ids(MessageId other_max_message_id, MessageId other_max_read_message_id);
bool update_max_message_ids(MessageId other_max_message_id, MessageId other_last_read_inbox_message_id,
MessageId other_last_read_outbox_message_id);
bool update_max_message_ids(const MessageReplyInfo &other);
@ -48,13 +50,15 @@ struct MessageReplyInfo {
bool has_recent_replier_dialog_ids = !recent_replier_dialog_ids.empty();
bool has_channel_id = channel_id.is_valid();
bool has_max_message_id = max_message_id.is_valid();
bool has_max_read_message_id = max_read_message_id.is_valid();
bool has_last_read_inbox_message_id = last_read_inbox_message_id.is_valid();
bool has_last_read_outbox_message_id = last_read_outbox_message_id.is_valid();
BEGIN_STORE_FLAGS();
STORE_FLAG(is_comment);
STORE_FLAG(has_recent_replier_dialog_ids);
STORE_FLAG(has_channel_id);
STORE_FLAG(has_max_message_id);
STORE_FLAG(has_max_read_message_id);
STORE_FLAG(has_last_read_inbox_message_id);
STORE_FLAG(has_last_read_outbox_message_id);
END_STORE_FLAGS();
td::store(reply_count, storer);
td::store(pts, storer);
@ -67,8 +71,11 @@ struct MessageReplyInfo {
if (has_max_message_id) {
td::store(max_message_id, storer);
}
if (has_max_read_message_id) {
td::store(max_read_message_id, storer);
if (has_last_read_inbox_message_id) {
td::store(last_read_inbox_message_id, storer);
}
if (has_last_read_outbox_message_id) {
td::store(last_read_outbox_message_id, storer);
}
}
@ -77,13 +84,15 @@ struct MessageReplyInfo {
bool has_recent_replier_dialog_ids;
bool has_channel_id;
bool has_max_message_id;
bool has_max_read_message_id;
bool has_last_read_inbox_message_id;
bool has_last_read_outbox_message_id;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(is_comment);
PARSE_FLAG(has_recent_replier_dialog_ids);
PARSE_FLAG(has_channel_id);
PARSE_FLAG(has_max_message_id);
PARSE_FLAG(has_max_read_message_id);
PARSE_FLAG(has_last_read_inbox_message_id);
PARSE_FLAG(has_last_read_outbox_message_id);
END_PARSE_FLAGS();
td::parse(reply_count, parser);
td::parse(pts, parser);
@ -96,8 +105,11 @@ struct MessageReplyInfo {
if (has_max_message_id) {
td::parse(max_message_id, parser);
}
if (has_max_read_message_id) {
td::parse(max_read_message_id, parser);
if (has_last_read_inbox_message_id) {
td::parse(last_read_inbox_message_id, parser);
}
if (has_last_read_outbox_message_id) {
td::parse(last_read_outbox_message_id, parser);
}
}
};

View File

@ -432,15 +432,19 @@ class GetDiscussionMessageQuery : public Td::ResultHandler {
td->contacts_manager_->on_get_chats(std::move(ptr->chats_), "GetDiscussionMessageQuery");
MessageId max_message_id;
MessageId max_read_message_id;
MessageId last_read_inbox_message_id;
MessageId last_read_outbox_message_id;
if ((ptr->flags_ & telegram_api::messages_discussionMessage::MAX_ID_MASK) != 0) {
max_message_id = MessageId(ServerMessageId(ptr->max_id_));
}
if ((ptr->flags_ & telegram_api::messages_discussionMessage::READ_MAX_ID_MASK) != 0) {
max_read_message_id = MessageId(ServerMessageId(ptr->read_max_id_));
if ((ptr->flags_ & telegram_api::messages_discussionMessage::READ_INBOX_MAX_ID_MASK) != 0) {
last_read_inbox_message_id = MessageId(ServerMessageId(ptr->read_inbox_max_id_));
}
if ((ptr->flags_ & telegram_api::messages_discussionMessage::READ_OUTBOX_MAX_ID_MASK) != 0) {
last_read_outbox_message_id = MessageId(ServerMessageId(ptr->read_outbox_max_id_));
}
td->messages_manager_->on_update_read_message_comments(dialog_id_, message_id_, max_message_id,
max_read_message_id);
last_read_inbox_message_id, last_read_outbox_message_id);
vector<FullMessageId> full_message_ids;
for (auto &message : ptr->messages_) {
@ -3248,8 +3252,9 @@ class SetTypingQuery : public Td::ResultHandler {
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Write);
CHECK(input_peer != nullptr);
auto net_query =
G()->net_query_creator().create(telegram_api::messages_setTyping(std::move(input_peer), std::move(action)));
int32 flags = 0;
auto net_query = G()->net_query_creator().create(
telegram_api::messages_setTyping(flags, std::move(input_peer), 0, std::move(action)));
auto result = net_query.get_weak();
send_query(std::move(net_query));
return result;
@ -6108,7 +6113,8 @@ void MessagesManager::on_update_read_channel_messages_contents(
}
void MessagesManager::on_update_read_message_comments(DialogId dialog_id, MessageId message_id,
MessageId max_message_id, MessageId max_read_message_id) {
MessageId max_message_id, MessageId last_read_inbox_message_id,
MessageId last_read_outbox_message_id) {
Dialog *d = get_dialog_force(dialog_id);
if (d == nullptr) {
LOG(INFO) << "Ignore update of read message comments in unknown " << dialog_id << " in updateReadDiscussion";
@ -6119,7 +6125,7 @@ void MessagesManager::on_update_read_message_comments(DialogId dialog_id, Messag
if (m == nullptr) {
return;
}
if (m->reply_info.update_max_message_ids(max_message_id, max_read_message_id)) {
if (m->reply_info.update_max_message_ids(max_message_id, last_read_inbox_message_id, last_read_outbox_message_id)) {
send_update_message_interaction_info(dialog_id, m);
on_message_changed(d, m, true, "on_update_read_message_comments");
}
@ -6291,7 +6297,8 @@ td_api::object_ptr<td_api::messageInteractionInfo> MessagesManager::get_message_
int32 reply_count = -1;
vector<UserId> recent_replier_user_ids;
MessageId max_read_message_id;
MessageId last_read_inbox_message_id;
MessageId last_read_outbox_message_id;
if (is_active_reply_info) {
reply_count = m->reply_info.reply_count;
for (auto recent_replier_dialog_id : m->reply_info.recent_replier_dialog_ids) {
@ -6299,13 +6306,14 @@ td_api::object_ptr<td_api::messageInteractionInfo> MessagesManager::get_message_
recent_replier_user_ids.push_back(recent_replier_dialog_id.get_user_id());
}
}
max_read_message_id = m->reply_info.max_read_message_id;
last_read_inbox_message_id = m->reply_info.last_read_inbox_message_id;
last_read_outbox_message_id = m->reply_info.last_read_outbox_message_id;
}
return td_api::make_object<td_api::messageInteractionInfo>(
m->view_count, m->forward_count, reply_count,
td_->contacts_manager_->get_user_ids_object(recent_replier_user_ids, "get_message_interaction_info_object"),
max_read_message_id.get());
last_read_inbox_message_id.get(), last_read_outbox_message_id.get());
}
bool MessagesManager::update_message_interaction_info(DialogId dialog_id, Message *m, int32 view_count,

View File

@ -335,7 +335,7 @@ class MessagesManager : public Actor {
tl_object_ptr<telegram_api::updateChannelReadMessagesContents> &&update);
void on_update_read_message_comments(DialogId dialog_id, MessageId message_id, MessageId max_message_id,
MessageId max_read_message_id);
MessageId last_read_inbox_message_id, MessageId last_read_outbox_message_id);
void on_update_channel_too_long(tl_object_ptr<telegram_api::updateChannelTooLong> &&update, bool force_apply);

View File

@ -1664,12 +1664,6 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChannelReadMess
td_->messages_manager_->on_update_read_channel_messages_contents(std::move(update));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadDiscussion> update, bool /*force_apply*/) {
td_->messages_manager_->on_update_read_message_comments(DialogId(update->peer_),
MessageId(ServerMessageId(update->msg_id_)), MessageId(),
MessageId(ServerMessageId(update->read_max_id_)));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChannelTooLong> update, bool force_apply) {
td_->messages_manager_->on_update_channel_too_long(std::move(update), force_apply);
}
@ -1725,6 +1719,20 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChannelAvailabl
ChannelId(update->channel_id_), MessageId(ServerMessageId(update->available_min_id_)));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadChannelDiscussionInbox> update,
bool /*force_apply*/) {
td_->messages_manager_->on_update_read_message_comments(
DialogId(ChannelId(update->channel_id_)), MessageId(ServerMessageId(update->top_msg_id_)),
MessageId(ServerMessageId(update->top_msg_id_)), MessageId(ServerMessageId(update->read_max_id_)), MessageId());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadChannelDiscussionOutbox> update,
bool /*force_apply*/) {
td_->messages_manager_->on_update_read_message_comments(
DialogId(ChannelId(update->channel_id_)), MessageId(ServerMessageId(update->top_msg_id_)),
MessageId(ServerMessageId(update->top_msg_id_)), MessageId(), MessageId(ServerMessageId(update->read_max_id_)));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserPinnedMessage> update, bool /*force_apply*/) {
td_->messages_manager_->on_update_dialog_pinned_message_id(DialogId(UserId(update->user_id_)),
MessageId(ServerMessageId(update->id_)));
@ -1885,16 +1893,37 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatUserTyping>
LOG(DEBUG) << "Ignore user chat typing of unknown " << user_id;
return;
}
ChatId chat_id(update->chat_id_);
DialogId dialog_id(chat_id);
DialogId dialog_id(ChatId(update->chat_id_));
if (!td_->messages_manager_->have_dialog(dialog_id)) {
ChannelId channel_id(update->chat_id_);
dialog_id = DialogId(channel_id);
if (!td_->messages_manager_->have_dialog(dialog_id)) {
LOG(DEBUG) << "Ignore user chat typing in unknown " << dialog_id;
LOG(DEBUG) << "Ignore user chat typing in unknown " << dialog_id;
return;
}
td_->messages_manager_->on_user_dialog_action(
dialog_id, user_id, convert_send_message_action(std::move(update->action_)), get_short_update_date());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChannelUserTyping> update, bool /*force_apply*/) {
UserId user_id(update->user_id_);
if (!td_->contacts_manager_->have_min_user(user_id)) {
LOG(DEBUG) << "Ignore user channel typing of unknown " << user_id;
return;
}
DialogId dialog_id(ChannelId(update->channel_id_));
if (!td_->messages_manager_->have_dialog(dialog_id)) {
LOG(DEBUG) << "Ignore user channel typing in unknown " << dialog_id;
return;
}
MessageId top_reply_message_id;
if ((update->flags_ & telegram_api::updateChannelUserTyping::TOP_MSG_ID_MASK) != 0) {
top_reply_message_id = MessageId(ServerMessageId(update->top_msg_id_));
if (!top_reply_message_id.is_valid() && top_reply_message_id != MessageId()) {
LOG(ERROR) << "Ignore user channel typing in replies of " << top_reply_message_id;
return;
}
}
if (top_reply_message_id.is_valid()) {
return;
}
td_->messages_manager_->on_user_dialog_action(
dialog_id, user_id, convert_send_message_action(std::move(update->action_)), get_short_update_date());
}
@ -1936,8 +1965,12 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserPhoto> upda
td_->contacts_manager_->on_update_user_photo(UserId(update->user_id_), std::move(update->photo_));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserBlocked> update, bool /*force_apply*/) {
td_->contacts_manager_->on_update_user_is_blocked(UserId(update->user_id_), update->blocked_);
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updatePeerBlocked> update, bool /*force_apply*/) {
DialogId dialog_id(update->peer_id_);
if (dialog_id.get_type() != DialogType::User) {
return;
}
td_->contacts_manager_->on_update_user_is_blocked(dialog_id.get_user_id(), update->blocked_);
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatParticipants> update, bool /*force_apply*/) {

View File

@ -218,13 +218,15 @@ class UpdatesManager : public Actor {
void on_update(tl_object_ptr<telegram_api::updateUserTyping> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatUserTyping> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChannelUserTyping> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateEncryptedChatTyping> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateUserStatus> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateUserName> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateUserPhone> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateUserPhoto> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateUserBlocked> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updatePeerBlocked> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatParticipants> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatParticipantAdd> update, bool /*force_apply*/);
@ -249,6 +251,9 @@ class UpdatesManager : public Actor {
void on_update(tl_object_ptr<telegram_api::updateChannelMessageForwards> update, bool force_apply);
void on_update(tl_object_ptr<telegram_api::updateChannelAvailableMessages> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateReadChannelDiscussionInbox> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateReadChannelDiscussionOutbox> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateUserPinnedMessage> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatPinnedMessage> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChannelPinnedMessage> update, bool /*force_apply*/);
@ -318,8 +323,6 @@ class UpdatesManager : public Actor {
// unsupported updates
void on_update(tl_object_ptr<telegram_api::updateTheme> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateReadDiscussion> update, bool /*force_apply*/);
};
} // namespace td