MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / ApplyChanges

Method ApplyChanges

Telegram/SourceFiles/data/data_web_page.cpp:398–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398void WebPageData::ApplyChanges(
399 not_null<Main::Session*> session,
400 ChannelData *channel,
401 const MTPmessages_Messages &result) {
402 const auto list = result.match([](
403 const MTPDmessages_messagesNotModified &) {
404 LOG(("API Error: received messages.messagesNotModified! "
405 "(WebPageData::ApplyChanges)"));
406 return static_cast<const QVector<MTPMessage>*>(nullptr);
407 }, [&](const auto &data) {
408 session->data().processUsers(data.vusers());
409 session->data().processChats(data.vchats());
410 return &data.vmessages().v;
411 });
412 result.match([&](
413 const MTPDmessages_channelMessages &data) {
414 if (channel) {
415 channel->ptsReceived(data.vpts().v);
416 channel->processTopics(data.vtopics());
417 } else {
418 LOG(("API Error: received messages.channelMessages "
419 "when no channel was passed! (WebPageData::ApplyChanges)"));
420 }
421 }, [&](const auto &) {
422 });
423 result.match([](
424 const MTPDmessages_messagesNotModified &) {
425 }, [&](const auto &data) {
426 if (channel) {
427 channel->processTopics(data.vtopics());
428 }
429 });
430 if (!list) {
431 return;
432 }
433
434 for (const auto &message : *list) {
435 message.match([&](const MTPDmessage &data) {
436 if (const auto media = data.vmedia()) {
437 media->match([&](const MTPDmessageMediaWebPage &data) {
438 session->data().processWebpage(data.vwebpage());
439 }, [&](const auto &) {
440 });
441 }
442 }, [&](const auto &) {
443 });
444 }
445 session->data().sendWebPageGamePollTodoListNotifications();
446}
447
448QString WebPageData::displayedSiteName() const {
449 return (document && document->isWallPaper())

Callers

nothing calls this directly

Calls 7

processUsersMethod · 0.80
processChatsMethod · 0.80
ptsReceivedMethod · 0.80
processTopicsMethod · 0.80
processWebpageMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected