diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 242e2e2ff..bb8206f89 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -760,8 +760,9 @@ pageBlockSlideshow page_blocks:vector caption:RichText = PageBlock; pageBlockChatLink title:string photo:chatPhoto username:string = PageBlock; -//@description Describes an instant view page for a web page @page_blocks Content of the web page @is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view -webPageInstantView page_blocks:vector is_full:Bool = WebPageInstantView; +//@description Describes an instant view page for a web page @page_blocks Content of the web page @is_rtl True, if the instant view must be shown from right to left +//@is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view +webPageInstantView page_blocks:vector is_rtl:Bool is_full:Bool = WebPageInstantView; //@description Describes a web page preview @url Original URL of the link @display_url URL to display @@ -1477,8 +1478,8 @@ callStatePending is_created:Bool is_received:Bool = CallState; //@description The call has been answered and encryption keys are being exchanged callStateExchangingKeys = CallState; -//@description The call is ready to use @protocol Call protocols supported by the peer @connections Available UDP reflectors @config A JSON-encoded call config @encryption_key Call encryption key @emojis Encryption key emojis fingerprint -callStateReady protocol:callProtocol connections:vector config:string encryption_key:bytes emojis:vector = CallState; +//@description The call is ready to use @protocol Call protocols supported by the peer @connections Available UDP reflectors @config A JSON-encoded call config @encryption_key Call encryption key @emojis Encryption key emojis fingerprint @allow_p2p True, if peer-to-peer connection is allowed by users privacy settings +callStateReady protocol:callProtocol connections:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool = CallState; //@description The call is hanging up after discardCall has been called callStateHangingUp = CallState; @@ -1926,19 +1927,23 @@ userPrivacySettingAllowChatInvites = UserPrivacySetting; //@description A privacy setting for managing whether the user can be called userPrivacySettingAllowCalls = UserPrivacySetting; +//@description A privacy setting for managing whether peer-to-peer connections can be used for calls +userPrivacySettingAllowPeerToPeerCalls = UserPrivacySetting; + //@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days accountTtl days:int32 = AccountTtl; //@description Contains information about one session in a Telegram application used by the current user @id Session identifier @is_current True, if this session is the current session +//@is_password_pending True, if a password is needed to complete authorization of the session //@api_id Telegram API identifier, as provided by the application @application_name Name of the application, as provided by the application //@application_version The version of the application, as provided by the application @is_official_application True, if the application is an official application or uses the api_id of an official application //@device_model Model of the device the application has been run or is running on, as provided by the application @platform Operating system the application has been run or is running on, as provided by the application //@system_version Version of the operating system the application has been run or is running on, as provided by the application @log_in_date Point in time (Unix timestamp) when the user has logged in //@last_active_date Point in time (Unix timestamp) when the session was last used @ip IP address from which the session was created, in human-readable format //@country A two-letter country code for the country from which the session was created, based on the IP address @region Region code from which the session was created, based on the IP address -session id:int64 is_current:Bool api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; +session id:int64 is_current:Bool is_password_pending:Bool api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; //@description Contains a list of sessions @sessions List of sessions sessions sessions:vector = Sessions; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 7ba809bf2..df170ad0a 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index 55f309690..a93a3c52d 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -416,10 +416,12 @@ contacts.found#b3134d9d my_results:Vector results:Vector chats:Vecto inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; +inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; +privacyKeyPhoneP2P#39491cc8 = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; @@ -467,7 +469,7 @@ webPagePending#c586da1c id:long date:int = WebPage; webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; webPageNotModified#85849473 = WebPage; -authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; +authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; @@ -675,6 +677,11 @@ textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; +textSubscript#ed6a8504 text:RichText = RichText; +textSuperscript#c7fb5e01 text:RichText = RichText; +textMarked#34b8621 text:RichText = RichText; +textPhone#1ccb966a text:RichText phone:string = RichText; +textImage#81ccf4f document_id:long w:int h:int = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; @@ -687,21 +694,24 @@ pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; -pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; +pageBlockList#e4e88011 items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; -pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; -pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; +pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock; +pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; -pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; -pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; -pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; -pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; +pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock; +pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:PageCaption = PageBlock; +pageBlockCollage#65a0fa4d items:Vector caption:PageCaption = PageBlock; +pageBlockSlideshow#31f9590 items:Vector caption:PageCaption = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; -pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; - -pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; -pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; +pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock; +pageBlockKicker#1e148390 text:RichText = PageBlock; +pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector = PageBlock; +pageBlockOrderedList#9a8ae1e1 items:Vector = PageBlock; +pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector title:RichText = PageBlock; +pageBlockRelatedArticles#16115a96 title:RichText articles:Vector = PageBlock; +pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; @@ -760,7 +770,7 @@ phoneCallEmpty#5366c915 id:long = PhoneCall; phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; -phoneCall#ffe6ab67 id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; +phoneCall#e6f9ddf3 flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; @@ -934,6 +944,22 @@ jsonString#b71e767a value:string = JSONValue; jsonArray#f7444763 value:Vector = JSONValue; jsonObject#99c1d49d value:Vector = JSONValue; +pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell; + +pageTableRow#e0c0c5e5 cells:Vector = PageTableRow; + +pageCaption#6f747657 text:RichText credit:RichText = PageCaption; + +pageListItemText#b92fb6cd text:RichText = PageListItem; +pageListItemBlocks#25e073fc blocks:Vector = PageListItem; + +pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem; +pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector = PageListOrderedItem; + +pageRelatedArticle#f186f93c flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long = PageRelatedArticle; + +page#f199a0a8 flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true blocks:Vector photos:Vector documents:Vector = Page; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; diff --git a/td/generate/scheme/telegram_api.tlo b/td/generate/scheme/telegram_api.tlo index 9dfe22f6e..2284e8fbe 100644 Binary files a/td/generate/scheme/telegram_api.tlo and b/td/generate/scheme/telegram_api.tlo differ diff --git a/td/telegram/CallActor.cpp b/td/telegram/CallActor.cpp index ce7267e70..b4954b60c 100644 --- a/td/telegram/CallActor.cpp +++ b/td/telegram/CallActor.cpp @@ -92,7 +92,7 @@ tl_object_ptr CallState::as_td_api() const { v.push_back(c.as_td_api()); } return make_tl_object(protocol.as_td_api(), std::move(v), config, key, - vector(emojis_fingerprint)); + vector(emojis_fingerprint), allow_p2p); } case Type::HangingUp: return make_tl_object(); @@ -375,6 +375,7 @@ Status CallActor::do_update_call(telegram_api::phoneCall &call) { call_state_.connections.push_back(CallConnection::from_telegram_api(*connection)); } call_state_.protocol = CallProtocol::from_telegram_api(*call.protocol_); + call_state_.allow_p2p = (call.flags_ & telegram_api::phoneCall::P2P_ALLOWED_MASK) != 0; call_state_.type = CallState::Type::Ready; call_state_need_flush_ = true; diff --git a/td/telegram/CallActor.h b/td/telegram/CallActor.h index 1467c0ac5..cec2ad68e 100644 --- a/td/telegram/CallActor.h +++ b/td/telegram/CallActor.h @@ -66,6 +66,7 @@ struct CallState { string key; string config; vector emojis_fingerprint; + bool allow_p2p{false}; Status error; diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 4de52292f..4b8c720f9 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -118,6 +118,7 @@ class GetAuthorizationsQuery : public Td::ResultHandler { Promise> promise_; static constexpr int32 AUTHORIZATION_FLAG_IS_CURRENT = 1 << 0; static constexpr int32 AUTHORIZATION_FLAG_IS_OFFICIAL_APPLICATION = 1 << 1; + static constexpr int32 AUTHORIZATION_FLAG_IS_PASSWORD_PENDING = 1 << 2; public: explicit GetAuthorizationsQuery(Promise> &&promise) : promise_(std::move(promise)) { @@ -142,9 +143,10 @@ class GetAuthorizationsQuery : public Td::ResultHandler { CHECK(authorization != nullptr); bool is_current = (authorization->flags_ & AUTHORIZATION_FLAG_IS_CURRENT) != 0; bool is_official_application = (authorization->flags_ & AUTHORIZATION_FLAG_IS_OFFICIAL_APPLICATION) != 0; + bool is_password_pending = (authorization->flags_ & AUTHORIZATION_FLAG_IS_PASSWORD_PENDING) != 0; results->sessions_.push_back(make_tl_object( - authorization->hash_, is_current, authorization->api_id_, authorization->app_name_, + authorization->hash_, is_current, is_password_pending, authorization->api_id_, authorization->app_name_, authorization->app_version_, is_official_application, authorization->device_model_, authorization->platform_, authorization->system_version_, authorization->date_created_, authorization->date_active_, authorization->ip_, authorization->country_, authorization->region_)); @@ -7090,7 +7092,7 @@ void ContactsManager::on_get_chat_participants(tl_object_ptr PrivacyManager::UserPrivacySetting::as return make_tl_object(); case Type::Call: return make_tl_object(); + case Type::PeerToPeerCall: + return make_tl_object(); default: UNREACHABLE(); return nullptr; @@ -64,6 +69,8 @@ tl_object_ptr PrivacyManager::UserPrivacySetting: return make_tl_object(); case Type::Call: return make_tl_object(); + case Type::PeerToPeerCall: + return make_tl_object(); default: UNREACHABLE(); return nullptr; @@ -81,6 +88,9 @@ PrivacyManager::UserPrivacySetting::UserPrivacySetting(const td_api::UserPrivacy case td_api::userPrivacySettingAllowCalls::ID: type_ = Type::Call; break; + case td_api::userPrivacySettingAllowPeerToPeerCalls::ID: + type_ = Type::PeerToPeerCall; + break; default: UNREACHABLE(); type_ = Type::UserState; diff --git a/td/telegram/PrivacyManager.h b/td/telegram/PrivacyManager.h index 94afcebc7..9f23d5a61 100644 --- a/td/telegram/PrivacyManager.h +++ b/td/telegram/PrivacyManager.h @@ -38,7 +38,7 @@ class PrivacyManager : public NetQueryCallback { private: class UserPrivacySetting { public: - enum class Type : int32 { UserState, ChatInvite, Call, Size }; + enum class Type : int32 { UserState, ChatInvite, Call, PeerToPeerCall, Size }; static Result from_td_api(tl_object_ptr key); explicit UserPrivacySetting(const telegram_api::PrivacyKey &key); diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 2cc72d6dd..07eb65857 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -135,6 +135,7 @@ class WebPagesManager::WebPageInstantView { public: vector> page_blocks; int32 hash = 0; + bool is_rtl = false; bool is_empty = true; bool is_full = false; bool is_loaded = false; @@ -146,6 +147,7 @@ class WebPagesManager::WebPageInstantView { BEGIN_STORE_FLAGS(); STORE_FLAG(is_full); STORE_FLAG(is_loaded); + STORE_FLAG(is_rtl); END_STORE_FLAGS(); store(page_blocks, storer); @@ -159,6 +161,7 @@ class WebPagesManager::WebPageInstantView { BEGIN_PARSE_FLAGS(); PARSE_FLAG(is_full); PARSE_FLAG(is_loaded); + PARSE_FLAG(is_rtl); END_PARSE_FLAGS(); parse(page_blocks, parser); @@ -2226,7 +2229,7 @@ tl_object_ptr WebPagesManager::get_web_page_instant_ return make_tl_object( transform(web_page_instant_view->page_blocks, [](const auto &page_block) { return page_block->get_page_block_object(); }), - web_page_instant_view->is_full); + web_page_instant_view->is_rtl, web_page_instant_view->is_full); } void WebPagesManager::update_messages_content(WebPageId web_page_id, bool have_web_page) { @@ -2481,7 +2484,8 @@ unique_ptr WebPagesManager::get_page_block( } case telegram_api::pageBlockList::ID: { auto page_block = move_tl_object_as(page_block_ptr); - return td::make_unique(get_rich_texts(std::move(page_block->items_)), page_block->ordered_); + return nullptr; + // return td::make_unique(get_rich_texts(std::move(page_block->items_)), page_block->ordered_); } case telegram_api::pageBlockBlockquote::ID: { auto page_block = move_tl_object_as(page_block_ptr); @@ -2502,7 +2506,7 @@ unique_ptr WebPagesManager::get_page_block( } else { photo = it->second; } - return make_unique(std::move(photo), get_rich_text(std::move(page_block->caption_))); + return make_unique(std::move(photo), get_rich_text(std::move(page_block->caption_->text_))); } case telegram_api::pageBlockVideo::ID: { auto page_block = move_tl_object_as(page_block_ptr); @@ -2511,8 +2515,8 @@ unique_ptr WebPagesManager::get_page_block( auto animations_it = animations.find(page_block->video_id_); if (animations_it != animations.end()) { LOG_IF(ERROR, !is_looped) << "Receive non-looped animation"; - return make_unique(animations_it->second, get_rich_text(std::move(page_block->caption_)), - need_autoplay); + return make_unique(animations_it->second, + get_rich_text(std::move(page_block->caption_->text_)), need_autoplay); } auto it = videos.find(page_block->video_id_); @@ -2520,8 +2524,8 @@ unique_ptr WebPagesManager::get_page_block( if (it != videos.end()) { video_file_id = it->second; } - return make_unique(video_file_id, get_rich_text(std::move(page_block->caption_)), need_autoplay, - is_looped); + return make_unique(video_file_id, get_rich_text(std::move(page_block->caption_->text_)), + need_autoplay, is_looped); } case telegram_api::pageBlockCover::ID: { auto page_block = move_tl_object_as(page_block_ptr); @@ -2546,7 +2550,7 @@ unique_ptr WebPagesManager::get_page_block( } return td::make_unique(std::move(page_block->url_), std::move(page_block->html_), std::move(poster_photo), get_dimensions(page_block->w_, page_block->h_), - get_rich_text(std::move(page_block->caption_)), is_full_width, + get_rich_text(std::move(page_block->caption_->text_)), is_full_width, allow_scrolling); } case telegram_api::pageBlockEmbedPost::ID: { @@ -2561,19 +2565,19 @@ unique_ptr WebPagesManager::get_page_block( return td::make_unique( std::move(page_block->url_), std::move(page_block->author_), std::move(author_photo), page_block->date_, get_page_blocks(std::move(page_block->blocks_), animations, audios, photos, videos), - get_rich_text(std::move(page_block->caption_))); + get_rich_text(std::move(page_block->caption_->text_))); } case telegram_api::pageBlockCollage::ID: { auto page_block = move_tl_object_as(page_block_ptr); return td::make_unique( get_page_blocks(std::move(page_block->items_), animations, audios, photos, videos), - get_rich_text(std::move(page_block->caption_))); + get_rich_text(std::move(page_block->caption_->text_))); } case telegram_api::pageBlockSlideshow::ID: { auto page_block = move_tl_object_as(page_block_ptr); return td::make_unique( get_page_blocks(std::move(page_block->items_), animations, audios, photos, videos), - get_rich_text(std::move(page_block->caption_))); + get_rich_text(std::move(page_block->caption_->text_))); } case telegram_api::pageBlockChannel::ID: { auto page_block = move_tl_object_as(page_block_ptr); @@ -2609,7 +2613,7 @@ unique_ptr WebPagesManager::get_page_block( if (it != audios.end()) { audio_file_id = it->second; } - return make_unique(audio_file_id, get_rich_text(std::move(page_block->caption_))); + return make_unique(audio_file_id, get_rich_text(std::move(page_block->caption_->text_))); } default: UNREACHABLE(); @@ -2632,20 +2636,15 @@ vector> WebPagesManager::get_page_blocks( return result; } -void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_ptr &&page_ptr, +void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_ptr &&page, int32 hash, DialogId owner_dialog_id) { - CHECK(page_ptr != nullptr); - vector> page_block_ptrs; - vector> photo_ptrs; - vector> document_ptrs; - downcast_call(*page_ptr, [&](auto &page) { - page_block_ptrs = std::move(page.blocks_); - photo_ptrs = std::move(page.photos_); - document_ptrs = std::move(page.documents_); - }); + CHECK(page != nullptr); + if ((page->flags_ & telegram_api::page::V2_MASK) == 0) { + return; + } std::unordered_map photos; - for (auto &photo_ptr : photo_ptrs) { + for (auto &photo_ptr : page->photos_) { if (photo_ptr->get_id() == telegram_api::photo::ID) { Photo photo = get_photo(td_->file_manager_.get(), move_tl_object_as(photo_ptr), owner_dialog_id); @@ -2660,7 +2659,7 @@ void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_ std::unordered_map animations; std::unordered_map audios; std::unordered_map videos; - for (auto &document_ptr : document_ptrs) { + for (auto &document_ptr : page->documents_) { if (document_ptr->get_id() == telegram_api::document::ID) { auto document = move_tl_object_as(document_ptr); auto document_id = document->id_; @@ -2701,13 +2700,14 @@ void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_ } } - LOG(INFO) << "Receive a web page instant view with " << page_block_ptrs.size() << " blocks, " << animations.size() + LOG(INFO) << "Receive a web page instant view with " << page->blocks_.size() << " blocks, " << animations.size() << " animations, " << audios.size() << " audios, " << photos.size() << " photos and " << videos.size() << " videos"; - web_page->instant_view.page_blocks = get_page_blocks(std::move(page_block_ptrs), animations, audios, photos, videos); + web_page->instant_view.page_blocks = get_page_blocks(std::move(page->blocks_), animations, audios, photos, videos); + web_page->instant_view.is_rtl = (page->flags_ & telegram_api::page::RTL_MASK) != 0; web_page->instant_view.hash = hash; web_page->instant_view.is_empty = false; - web_page->instant_view.is_full = page_ptr->get_id() == telegram_api::pageFull::ID; + web_page->instant_view.is_full = (page->flags_ & telegram_api::page::PART_MASK) == 0; web_page->instant_view.is_loaded = true; LOG(DEBUG) << "Receive web page instant view: " diff --git a/td/telegram/WebPagesManager.h b/td/telegram/WebPagesManager.h index 3b4d01310..0efbb9092 100644 --- a/td/telegram/WebPagesManager.h +++ b/td/telegram/WebPagesManager.h @@ -183,7 +183,7 @@ class WebPagesManager : public Actor { const std::unordered_map &photos, const std::unordered_map &videos) const; - void on_get_web_page_instant_view(WebPage *web_page, tl_object_ptr &&page_ptr, int32 hash, + void on_get_web_page_instant_view(WebPage *web_page, tl_object_ptr &&page, int32 hash, DialogId owner_dialog_id); void save_web_page(const WebPage *web_page, WebPageId web_page_id, bool from_binlog); diff --git a/td/telegram/net/MtprotoHeader.cpp b/td/telegram/net/MtprotoHeader.cpp index a9a1cffa6..68c1a7e20 100644 --- a/td/telegram/net/MtprotoHeader.cpp +++ b/td/telegram/net/MtprotoHeader.cpp @@ -21,7 +21,7 @@ class HeaderStorer { } template void store(StorerT &storer) const { - constexpr int32 LAYER = 87; + constexpr int32 LAYER = 88; using td::store; // invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;