| 71 | } |
| 72 | |
| 73 | void 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 | |
| 105 | Websites::List Websites::list() const { |
| 106 | return _list; |
no test coverage detected