Support updates.difference in on_get_pts_update.

This commit is contained in:
levlam 2023-04-27 22:47:45 +03:00
parent 797156bf11
commit da813f3ee9
2 changed files with 10 additions and 2 deletions

View File

@ -63,7 +63,8 @@ bool TD_TL_writer::is_full_constructor_generated(const tl::tl_combinator *t, boo
t->name == "encryptedChatWaiting" || t->name == "encryptedChatRequested" || t->name == "encryptedChat" ||
t->name == "langPackString" || t->name == "langPackStringPluralized" || t->name == "langPackStringDeleted" ||
t->name == "peerUser" || t->name == "peerChat" || t->name == "updateServiceNotification" ||
t->name == "updateNewMessage" || t->name == "updateChannelTooLong" || t->name == "messages.stickerSet";
t->name == "updateNewMessage" || t->name == "updateChannelTooLong" || t->name == "messages.stickerSet" ||
t->name == "updates.differenceSlice";
}
int TD_TL_writer::get_storer_type(const tl::tl_combinator *t, const std::string &storer_name) const {

View File

@ -1905,6 +1905,14 @@ void UpdatesManager::on_get_pts_update(int32 pts,
LOG(DEBUG) << "Receive update with PTS " << pts << ": " << to_string(difference_ptr);
switch (difference_ptr->get_id()) {
case telegram_api::updates_difference::ID: {
auto difference = move_tl_object_as<telegram_api::updates_difference>(difference_ptr);
difference_ptr = telegram_api::make_object<telegram_api::updates_differenceSlice>(
std::move(difference->new_messages_), std::move(difference->new_encrypted_messages_),
std::move(difference->other_updates_), std::move(difference->chats_), std::move(difference->users_),
std::move(difference->state_));
// fallthrough
}
case telegram_api::updates_differenceSlice::ID: {
auto difference = move_tl_object_as<telegram_api::updates_differenceSlice>(difference_ptr);
@ -1946,7 +1954,6 @@ void UpdatesManager::on_get_pts_update(int32 pts,
break;
}
case telegram_api::updates_differenceEmpty::ID:
case telegram_api::updates_difference::ID:
case telegram_api::updates_differenceTooLong::ID: {
LOG(ERROR) << "Receive " << to_string(difference_ptr);
break;