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

Method exportDirectStoryLink

Telegram/SourceFiles/apiwrap.cpp:865–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

863}
864
865QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
866 const auto storyId = story->fullId();
867 const auto peer = story->peer();
868 const auto fallback = [&] {
869 const auto base = peer->username();
870 const auto id = story->call()
871 ? u"live"_q
872 : QString::number(storyId.story);
873 const auto query = base + "/s/" + id;
874 return session().createInternalLinkFull(query);
875 };
876 const auto i = _unlikelyStoryLinks.find(storyId);
877 const auto current = (i != end(_unlikelyStoryLinks))
878 ? i->second
879 : fallback();
880 request(MTPstories_ExportStoryLink(
881 peer->input(),
882 MTP_int(story->id())
883 )).done([=](const MTPExportedStoryLink &result) {
884 const auto link = qs(result.data().vlink());
885 if (current != link) {
886 _unlikelyStoryLinks.emplace_or_assign(storyId, link);
887 }
888 }).send();
889 return current;
890}
891
892void ApiWrap::requestContacts() {
893 if (_session->data().contactsLoaded().current() || _contactsRequestId) {

Callers 2

PrepareShareBoxFunction · 0.80
CopyStoryLinkFunction · 0.80

Calls 13

qsFunction · 0.85
MTP_intFunction · 0.50
fullIdMethod · 0.45
peerMethod · 0.45
usernameMethod · 0.45
callMethod · 0.45
findMethod · 0.45
sendMethod · 0.45
doneMethod · 0.45
inputMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected