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

Method saveViewAsMessages

Telegram/SourceFiles/data/data_session.cpp:5564–5584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5562}
5563
5564void Session::saveViewAsMessages(
5565 not_null<Forum*> forum,
5566 bool viewAsMessages) {
5567 const auto channel = forum->channel();
5568 if (!channel) {
5569 return;
5570 }
5571 if (const auto requestId = _viewAsMessagesRequests.take(channel)) {
5572 _session->api().request(*requestId).cancel();
5573 }
5574 _viewAsMessagesRequests[channel] = _session->api().request(
5575 MTPchannels_ToggleViewForumAsMessages(
5576 channel->inputChannel(),
5577 MTP_bool(viewAsMessages))
5578 ).done([=] {
5579 _viewAsMessagesRequests.remove(channel);
5580 }).fail([=] {
5581 _viewAsMessagesRequests.remove(channel);
5582 }).send();
5583 channel->setViewAsMessagesFlag(viewAsMessages);
5584}
5585
5586void Session::webViewResultSent(WebViewResultSent &&sent) {
5587 return _webViewResultSent.fire(std::move(sent));

Callers 3

addViewAsMessagesMethod · 0.80
addViewAsTopicsMethod · 0.80
chosenRowMethod · 0.80

Calls 12

MTP_boolFunction · 0.85
apiMethod · 0.80
inputChannelMethod · 0.80
setViewAsMessagesFlagMethod · 0.80
channelMethod · 0.45
takeMethod · 0.45
cancelMethod · 0.45
requestMethod · 0.45
sendMethod · 0.45
failMethod · 0.45
doneMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected