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

Function FastShareMessageToSelf

Telegram/SourceFiles/boxes/share_box.cpp:2067–2096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2065}
2066
2067void FastShareMessageToSelf(
2068 std::shared_ptr<Main::SessionShow> show,
2069 not_null<HistoryItem*> item) {
2070 const auto self = show->session().user();
2071 auto &owner = self->owner();
2072 const auto items = owner.idsToItems(owner.itemOrItsGroup(item));
2073 const auto donePhraseArgs = ChatHelpers::ForwardedMessagePhraseArgs{
2074 .toCount = 1,
2075 .singleMessage = (items.size() == 1),
2076 .to1 = self,
2077 .to2 = nullptr,
2078 };
2079 auto sendAction = Api::SendAction(owner.history(self));
2080 sendAction.clearDraft = false;
2081 show->session().api().forwardMessages(
2082 Data::ResolvedForwardDraft{ .items = items },
2083 std::move(sendAction),
2084 [=] {
2085 auto phrase = rpl::variable<TextWithEntities>(
2086 ChatHelpers::ForwardedMessagePhrase(
2087 donePhraseArgs)).current();
2088 if (!phrase.empty()) {
2089 show->showToast({
2090 .text = std::move(phrase),
2091 .filter = ChatHelpers::ForwardedToSavedMessagesFilter(
2092 &show->session()),
2093 });
2094 }
2095 });
2096}
2097
2098void FastShareMessage(
2099 not_null<Window::SessionController*> controller,

Callers 1

Calls 15

ForwardedMessagePhraseFunction · 0.85
idsToItemsMethod · 0.80
itemOrItsGroupMethod · 0.80
forwardMessagesMethod · 0.80
apiMethod · 0.80
SendActionClass · 0.50
userMethod · 0.45
sessionMethod · 0.45
ownerMethod · 0.45
sizeMethod · 0.45
historyMethod · 0.45

Tested by

no test coverage detected