Drop repair_request_version after failed GetChannelFullQuery.

This commit is contained in:
levlam 2021-04-12 04:20:43 +03:00
parent 105542fc9a
commit e72863ff84
2 changed files with 25 additions and 0 deletions

View File

@ -2788,6 +2788,7 @@ class GetChatsQuery : public Td::ResultHandler {
class GetFullChatQuery : public Td::ResultHandler {
Promise<Unit> promise_;
ChatId chat_id_;
public:
explicit GetFullChatQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
@ -2811,6 +2812,7 @@ class GetFullChatQuery : public Td::ResultHandler {
}
void on_error(uint64 id, Status status) override {
td->contacts_manager_->on_get_chat_full_failed(chat_id_);
promise_.set_error(std::move(status));
}
};
@ -2895,6 +2897,7 @@ class GetFullChannelQuery : public Td::ResultHandler {
void on_error(uint64 id, Status status) override {
td->contacts_manager_->on_get_channel_error(channel_id_, status, "GetFullChannelQuery");
td->contacts_manager_->on_get_channel_full_failed(channel_id_);
promise_.set_error(std::move(status));
}
};
@ -10672,6 +10675,26 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
promise.set_value(Unit());
}
void ContactsManager::on_get_chat_full_failed(ChatId chat_id) {
if (G()->close_flag()) {
return;
}
LOG(INFO) << "Failed to get " << chat_id;
}
void ContactsManager::on_get_channel_full_failed(ChannelId channel_id) {
if (G()->close_flag()) {
return;
}
LOG(INFO) << "Failed to get " << channel_id;
auto channel_full = get_channel_full(channel_id, "on_get_channel_full");
if (channel_full != nullptr) {
channel_full->repair_request_version = 0;
}
}
bool ContactsManager::is_update_about_username_change_received(UserId user_id) const {
const User *u = get_user(user_id);
if (u != nullptr) {

View File

@ -177,6 +177,8 @@ class ContactsManager : public Actor {
void on_get_chats(vector<tl_object_ptr<telegram_api::Chat>> &&chats, const char *source);
void on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_full, Promise<Unit> &&promise);
void on_get_chat_full_failed(ChatId chat_id);
void on_get_channel_full_failed(ChannelId channel_id);
void on_update_profile_success(int32 flags, const string &first_name, const string &last_name, const string &about);
void on_set_bot_commands_success(vector<std::pair<string, string>> &&commands);