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

Method requestTerminate

Telegram/SourceFiles/api/api_authorizations.cpp:157–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void Authorizations::requestTerminate(
158 Fn<void(const MTPBool &result)> &&done,
159 Fn<void(const MTP::Error &error)> &&fail,
160 std::optional<uint64> hash) {
161 const auto send = [&](auto request) {
162 _api.request(
163 std::move(request)
164 ).done([=, done = std::move(done)](const MTPBool &result) {
165 done(result);
166 if (mtpIsTrue(result)) {
167 if (hash) {
168 _list.erase(
169 ranges::remove(_list, *hash, &Entry::hash),
170 end(_list));
171 } else {
172 _list.clear();
173 }
174 _listChanges.fire({});
175 }
176 }).fail(
177 std::move(fail)
178 ).send();
179 };
180 if (hash) {
181 send(MTPaccount_ResetAuthorization(MTP_long(*hash)));
182 } else {
183 send(MTPauth_ResetAuthorizations());
184 }
185}
186
187Authorizations::List Authorizations::list() const {
188 return _list;

Callers

nothing calls this directly

Calls 10

mtpIsTrueFunction · 0.85
sendFunction · 0.85
MTP_longFunction · 0.85
sendMethod · 0.45
failMethod · 0.45
doneMethod · 0.45
requestMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45
fireMethod · 0.45

Tested by

no test coverage detected