Skip to content
Snippets Groups Projects
Commit ffc180d0 authored by Anthony Léonard's avatar Anthony Léonard Committed by Nicolas Jager
Browse files

make addContact() preserve profile::Type


On non-DBus platform, when trusting a pending contact. The call from
daemon to ContactModelPimpl::addToContacts happens before the end of
ContactModel::addContact. This has the effect of switching the profile
type to RING then back to PENDING.

We now ensure that profileInfo.type is set according to the value
already present in pimpl_->contacts if any.

Change-Id: I4609056fe9191d00affe93ef1223bd06073b2276
Reviewed-by: default avatarNicolas Jäger <nicolas.jager@savoirfairelinux.com>
parent 9e6743a3
No related branches found
No related tags found
No related merge requests found
...@@ -219,8 +219,13 @@ ContactModel::addContact(contact::Info contactInfo) ...@@ -219,8 +219,13 @@ ContactModel::addContact(contact::Info contactInfo)
auto iter = pimpl_->contacts.find(contactInfo.profileInfo.uri); auto iter = pimpl_->contacts.find(contactInfo.profileInfo.uri);
if (iter == pimpl_->contacts.end()) if (iter == pimpl_->contacts.end())
pimpl_->contacts.emplace_hint(iter, contactInfo.profileInfo.uri, contactInfo); pimpl_->contacts.emplace_hint(iter, contactInfo.profileInfo.uri, contactInfo);
else else {
// On non-DBus platform, contactInfo.profileInfo.type may be wrong as the contact
// may be trusted already. We must use Profile::Type from pimpl_->contacts
// and not from contactInfo so we cannot revert a contact back to PENDING.
contactInfo.profileInfo.type = iter->second.profileInfo.type;
iter->second.profileInfo = contactInfo.profileInfo; iter->second.profileInfo = contactInfo.profileInfo;
}
emit contactAdded(profile.uri); emit contactAdded(profile.uri);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment