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

Method requestTerminate

Telegram/SourceFiles/api/api_websites.cpp:73–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void Websites::requestTerminate(
74 Fn<void(const MTPBool &result)> &&done,
75 Fn<void(const MTP::Error &error)> &&fail,
76 std::optional<uint64> hash,
77 UserData *botToBlock) {
78 const auto send = [&](auto request) {
79 _api.request(
80 std::move(request)
81 ).done([=, done = std::move(done)](const MTPBool &result) {
82 done(result);
83 if (hash) {
84 _list.erase(
85 ranges::remove(_list, *hash, &Entry::hash),
86 end(_list));
87 } else {
88 _list.clear();
89 }
90 _listChanges.fire({});
91 }).fail(
92 std::move(fail)
93 ).send();
94 };
95 if (hash) {
96 send(MTPaccount_ResetWebAuthorization(MTP_long(*hash)));
97 if (botToBlock) {
98 botToBlock->session().api().blockedPeers().block(botToBlock);
99 }
100 } else {
101 send(MTPaccount_ResetWebAuthorizations());
102 }
103}
104
105Websites::List Websites::list() const {
106 return _list;

Callers 4

terminateOneMethod · 0.45
terminateAllMethod · 0.45
terminateOneMethod · 0.45
terminateAllMethod · 0.45

Calls 12

sendFunction · 0.85
MTP_longFunction · 0.85
apiMethod · 0.80
sendMethod · 0.45
failMethod · 0.45
doneMethod · 0.45
requestMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45
fireMethod · 0.45
blockMethod · 0.45
sessionMethod · 0.45

Tested by

no test coverage detected