| 503 | } |
| 504 | |
| 505 | PollMedia PollMediaFromMTP( |
| 506 | not_null<Data::Session*> owner, |
| 507 | const MTPMessageMedia &media) { |
| 508 | auto result = PollMedia(); |
| 509 | media.match([&](const MTPDmessageMediaPhoto &data) { |
| 510 | if (const auto photo = data.vphoto()) { |
| 511 | photo->match([&](const MTPDphoto &) { |
| 512 | result.photo = owner->processPhoto(*photo); |
| 513 | }, [](const auto &) { |
| 514 | }); |
| 515 | } |
| 516 | }, [&](const MTPDmessageMediaDocument &data) { |
| 517 | if (const auto document = data.vdocument()) { |
| 518 | document->match([&](const MTPDdocument &) { |
| 519 | result.document = owner->processDocument(*document); |
| 520 | }, [](const auto &) { |
| 521 | }); |
| 522 | } |
| 523 | }, [&](const MTPDmessageMediaGeo &data) { |
| 524 | data.vgeo().match([&](const MTPDgeoPoint &point) { |
| 525 | result.geo = Data::LocationPoint(point); |
| 526 | }, [](const MTPDgeoPointEmpty &) { |
| 527 | }); |
| 528 | }, [&](const MTPDmessageMediaVenue &data) { |
| 529 | data.vgeo().match([&](const MTPDgeoPoint &point) { |
| 530 | result.geo = Data::LocationPoint(point); |
| 531 | }, [](const MTPDgeoPointEmpty &) { |
| 532 | }); |
| 533 | }, [&](const MTPDmessageMediaWebPage &data) { |
| 534 | data.vwebpage().match([&](const MTPDwebPage &page) { |
| 535 | result.webpage = owner->processWebpage(page); |
| 536 | }, [&](const MTPDwebPagePending &page) { |
| 537 | result.webpage = owner->processWebpage(page); |
| 538 | }, [&](const MTPDwebPageEmpty &page) { |
| 539 | if (const auto url = page.vurl()) { |
| 540 | result.url = qs(*url); |
| 541 | } |
| 542 | }, [&](const MTPDwebPageNotModified &page) { |
| 543 | }); |
| 544 | if (result.webpage && !result.webpage->url.isEmpty()) { |
| 545 | result.url = result.webpage->url; |
| 546 | } |
| 547 | }, [](const auto &) { |
| 548 | }); |
| 549 | return result; |
| 550 | } |
| 551 | |
| 552 | PollMedia PollMediaFromInputMTP( |
| 553 | not_null<Data::Session*> owner, |
no test coverage detected