Add do_import_contacts.

This commit is contained in:
levlam 2021-11-11 21:57:09 +03:00
parent f78f3407f8
commit 8db8f170f1
2 changed files with 8 additions and 2 deletions

View File

@ -5500,10 +5500,14 @@ std::pair<vector<UserId>, vector<int32>> 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<ImportContactsQuery>(std::move(promise))->send(contacts, random_id);
do_import_contacts(contacts, random_id, std::move(promise));
return {};
}
void ContactsManager::do_import_contacts(vector<Contact> contacts, int64 random_id, Promise<Unit> &&promise) {
td_->create_handler<ImportContactsQuery>(std::move(promise))->send(std::move(contacts), random_id);
}
void ContactsManager::remove_contacts(const vector<UserId> &user_ids, Promise<Unit> &&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<Contact> &&contacts, vec
imported_contacts_unique_id_ = std::move(contacts_unique_id);
imported_contacts_pos_ = std::move(to_add.first);
td_->create_handler<ImportContactsQuery>(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<Unit> &&promise) {

View File

@ -1372,6 +1372,8 @@ class ContactsManager final : public Actor {
void on_get_contacts_finished(size_t expected_contact_count);
void do_import_contacts(vector<Contact> contacts, int64 random_id, Promise<Unit> &&promise);
void load_imported_contacts(Promise<Unit> &&promise);
void on_load_imported_contacts_from_database(string value);