diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index f35cf2888..bc3d79e3c 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -5500,10 +5500,14 @@ std::pair, vector> ContactsManager::import_contacts(const } while (random_id == 0 || imported_contacts_.find(random_id) != imported_contacts_.end()); imported_contacts_[random_id]; // reserve place for result - td_->create_handler(std::move(promise))->send(contacts, random_id); + do_import_contacts(contacts, random_id, std::move(promise)); return {}; } +void ContactsManager::do_import_contacts(vector contacts, int64 random_id, Promise &&promise) { + td_->create_handler(std::move(promise))->send(std::move(contacts), random_id); +} + void ContactsManager::remove_contacts(const vector &user_ids, Promise &&promise) { LOG(INFO) << "Delete contacts: " << format::as_array(user_ids); if (!are_contacts_loaded_) { @@ -5759,7 +5763,7 @@ void ContactsManager::on_clear_imported_contacts(vector &&contacts, vec imported_contacts_unique_id_ = std::move(contacts_unique_id); imported_contacts_pos_ = std::move(to_add.first); - td_->create_handler(std::move(promise))->send(std::move(to_add.second), 0); + do_import_contacts(std::move(to_add.second), 0, std::move(promise)); } void ContactsManager::clear_imported_contacts(Promise &&promise) { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index dbc2ccc4b..7f853510d 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1372,6 +1372,8 @@ class ContactsManager final : public Actor { void on_get_contacts_finished(size_t expected_contact_count); + void do_import_contacts(vector contacts, int64 random_id, Promise &&promise); + void load_imported_contacts(Promise &&promise); void on_load_imported_contacts_from_database(string value);